stack problem

Reiner Beck R.Beck at
Tue Jul 12 09:51:50 UTC 2005


trying to increase the stack size is the wrong solution for your 
problem. You should definitely try to reduce the size of your class, as 
was suggested in an earlier mail. Just try to imagine what happens if 
you copy the class over the stack (e.g. a "push_back()" in a STL vector) 
- looming disaster. And more pitfalls to discover ...

Try to allocate the memory in the heap - the change in your code is not 
that big (even if you are supposed to change as little as possible: the 
change will be a big improvement):

class MyClass
   MyClass() :
      myArray = new int[myconst];
      if (myArray == NULL)   // check if you got the memory
         ::exit(1);   // or do something else

      delete [] myArray;   // release the memory

   int* myArray;



> Hi,
> I use some extremely large arrays like : int myArray[myconst] and 
> myconst can be eg. 1000000. My total amount of space required for an 
> instance of the class is about 26,6 MB. I am reusing code which I have 
> not written myself and I am not supposed to change to much.
> Ellen

to unsubscribe from this list send an email to kdevelop-request at with the following body:
unsubscribe »your-email-address«

More information about the KDevelop mailing list