[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pbmserv-dev] Q: about running programs
Douglas:
> I ran out of variables space in my program. Is that possible?
As Martin said, I think it could be, if you happen to put huge variables
onto the stack (or into the local heap if there still happens to be some)
instead of into free memory (with new). (Or you ran into an endless recursive
call, or you wrote a string onto a pointer instead of the memory it points
to, or the string lacked an ending zero or was longer than the memory - but
you seem to have excluded those bugs already.)
I may have an outsider look onto your code if you want.
Martin:
> int someFunction()
> { int *myInt;
> myInt=(int *)malloc(sizeof(int)*10000);
> ...
> free(myInt);
> }
Nowadays that can also be
int someFunction()
{ int *myInt = new int[10000];
...
delete[] myInt;
}
Claude