Mail Archives: djgpp/1997/10/14/14:58:08
Last week Eli didn't beleave me that GCC uses huges amounts of memory for
arrays making impossible the generation of a 300Kb .o file with 40Mb of
memory. He asked for exact values, here are:
Data type: unsigned chars
Size of the array: 182,520 bytes
Data memory used by GCC (2.7.2.1): 37,306,480
.o file generated: 182,895 bytes
So the rest of arrays I need for the font (that's the content of the array)
doesn't feet in 40Mb.
I think that's too bad. But is even WORST, you can think: "SET is using a
special array that consumes too much memory because of some particularity".
Well the situation is the reverse! Using this code to generate the array:
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
printf("unsigned char x[]={\n");
for (i=0; i<182520; i++)
{
printf("%d",i % 256);
if (i!=182519)
printf(",");
if ((i % 20)==19)
printf("\n");
}
printf("};\n");
return 0;
}
I got "out of virtual"!!!!!, perhaps that isn't very important because you
don't know what go32-v2 reports in my machine:
DPMI memory available: 27435 Kb
DPMI swap space available: 130389 Kb
So 128Mb is not enough!!
I then tried this program to generate the array:
#include <stdio.h>
int main(int argc, char *argv[])
{
int i;
printf("unsigned char x[]={\n");
for (i=0; i<182520; i++)
{
printf("%d",i % 2);
if (i!=182519)
printf(",");
if ((i % 20)==19)
printf("\n");
}
printf("};\n");
return 0;
}
And it consumed 37Mb as the fonts. Seems that here there are some exponential
use of memory.
The conclution is very easy: NEVER use GCC for large static arrays, use AS.
SET
------------------------------------ 0 --------------------------------
Visit my home page: http://www.geocities.com/SiliconValley/Vista/6552/
Salvador Eduardo Tropea (SET). (Electronics Engineer)
Alternative e-mail: set-sot AT usa DOT net - ICQ: 2951574
Address: Curapaligue 2124, Caseros, 3 de Febrero
Buenos Aires, (1678), ARGENTINA
TE: +(541) 759 0013
- Raw text -