Huge C static memory allocation

Post Reply
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Huge C static memory allocation

Post by Enrico Maria Giordano »

How can I successful compile the following sample using BCC?

Code: Select all

char Array[ 68000000 ][ 5 ];


int main()
{
    return 0;
}
I get the followin error message:

Code: Select all

Fatal: Out of memory
EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Huge C static memory allocation

Post by Antonio Linares »

Enrico,

Why don't you allocate memory dinamically in runtime using hb_xgrab() ?

It is the right way to do it or you run out of stack memory
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Huge C static memory allocation

Post by Enrico Maria Giordano »

Antonio,

I know about dynamic allocation but I asked specifically for static allocation that doesn't use heap or stack.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Huge C static memory allocation

Post by Antonio Linares »

I guess that you may have found a Borland bug
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Huge C static memory allocation

Post by Antonio Linares »

You could try it with Visual C++ and see what happens
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Huge C static memory allocation

Post by Antonio Linares »

Then it confirms it is a Borland bug

Anyhow I don't see it as dangerous one for the apps
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply