Page 1 of 1

Huge C static memory allocation

Posted: Sat Oct 10, 2015 4:06 pm
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

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 6:10 am
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

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 8:11 am
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

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 8:17 am
by Antonio Linares
I guess that you may have found a Borland bug

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 8:30 am
by Enrico Maria Giordano
:-(

EMG

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 9:49 am
by Antonio Linares
You could try it with Visual C++ and see what happens

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 10:17 am
by Enrico Maria Giordano
Antonio,

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

EMG

Re: Huge C static memory allocation

Posted: Sun Oct 11, 2015 10:42 am
by Antonio Linares
Then it confirms it is a Borland bug

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