Huge C static memory allocation

Post Reply
User avatar
Enrico Maria Giordano
Posts: 8734
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 1 time
Contact:

Huge C static memory allocation

Post by Enrico Maria Giordano »

How can I successful compile the following sample using BCC?

Code: Select all | Expand

char Array[ 68000000 ][ 5 ];


int main()
{
    return 0;
}


I get the followin error message:

Code: Select all | Expand

Fatal: Out of memory


EMG
User avatar
Antonio Linares
Site Admin
Posts: 42403
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 47 times
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: 8734
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 1 time
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: 42403
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 47 times
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: 42403
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 47 times
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
Enrico Maria Giordano
Posts: 8734
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 1 time
Contact:

Re: Huge C static memory allocation

Post by Enrico Maria Giordano »

Antonio,

I've already tried with another C compiler and got no error message.

EMG
User avatar
Antonio Linares
Site Admin
Posts: 42403
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 12 times
Been thanked: 47 times
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