Out of memory issues

Delphi & C++ Builder programming problems.

Out of memory issues

Postby lgama » Wed Nov 14, 2012 3:26 pm

Hello. I'd like to know how to deal with the "out of memory" error when i try to compile a very large app in C++ builder XE.
thanks
lgama
 
Posts: 1
Joined: Wed Nov 14, 2012 3:20 pm

Re: Out of memory issues

Postby Tracer » Wed Nov 14, 2012 7:30 pm

If this happens when you compile you probably have stack overflow. To many static objects can cause this. Declarations like

int vector[20000000];

should be avoided since these objects are on stack. Better to put them on heap:

int* vector = new int[20000000];

and delete after it's not in use, or to use smart pointers that do it for you.
User avatar
Tracer
Site Admin
 
Posts: 12
Joined: Sun Nov 11, 2012 4:54 pm


Return to Delphi & C++ Builder

Who is online

Users browsing this forum: No registered users and 0 guests

cron