Huge C static memory allocation

Huge C static memory allocation

Postby Enrico Maria Giordano » Sat Oct 10, 2015 4:06 pm

How can I successful compile the following sample using BCC?

Code: Select all  Expand view
char Array[ 68000000 ][ 5 ];


int main()
{
    return 0;
}


I get the followin error message:

Code: Select all  Expand view
Fatal: Out of memory


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Huge C static memory allocation

Postby Antonio Linares » Sun Oct 11, 2015 6:10 am

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
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Huge C static memory allocation

Postby Enrico Maria Giordano » Sun Oct 11, 2015 8:11 am

Antonio,

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Huge C static memory allocation

Postby Antonio Linares » Sun Oct 11, 2015 8:17 am

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

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


Re: Huge C static memory allocation

Postby Antonio Linares » Sun Oct 11, 2015 9:49 am

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: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Huge C static memory allocation

Postby Enrico Maria Giordano » Sun Oct 11, 2015 10:17 am

Antonio,

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8715
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Huge C static memory allocation

Postby Antonio Linares » Sun Oct 11, 2015 10:42 am

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to Off Topic / Otros temas

Who is online

Users browsing this forum: No registered users and 28 guests