FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index Off Topic / Otros temas Huge C static memory allocation
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Huge C static memory allocation
Posted: Sat Oct 10, 2015 04:06 PM
How can I successful compile the following sample using BCC?

Code (fw): Select all Collapse
char Array[ 68000000 ][ 5 ];


int main()
{
    return 0;
}


I get the followin error message:

Code (fw): Select all Collapse
Fatal: Out of memory


EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Huge C static memory allocation
Posted: Sun Oct 11, 2015 06: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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Huge C static memory allocation
Posted: Sun Oct 11, 2015 08:11 AM

Antonio,

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

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Huge C static memory allocation
Posted: Sun Oct 11, 2015 08:17 AM

I guess that you may have found a Borland bug

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Huge C static memory allocation
Posted: Sun Oct 11, 2015 09:49 AM

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

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Huge C static memory allocation
Posted: Sun Oct 11, 2015 10:17 AM

Antonio,

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

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Huge C static memory allocation
Posted: 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

Continue the discussion