www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/14/10:19:24

Sender: root AT sympatico DOT ca
Message-ID: <32B2BB73.7F3FB61D@sympatico.ca>
Date: Sat, 14 Dec 1996 09:36:35 -0500
From: "Mike A. Harris" <mharris AT sympatico DOT ca>
MIME-Version: 1.0
To: Alexey Kouzmitch <alexey AT ix DOT netcom DOT com>
CC: djgpp AT delorie DOT com
Subject: Re: Something REALLY weird
References: <01bbe874$f4290540$aa49bacd AT alexey DOT ix DOT netcom DOT com>

Alexey Kouzmitch wrote:
> 
>         Hi, can someone help me please...
>         I have a main file including 3 more with #include, plus it uses Allegro...
> Well, compiles OK, runs OK, but 5.8 MEGS long with 6% of actually being
> non-zero bytes ??? Wow, I said... WHY ??? I get a bit of code (around 3%)
> in the beginning, then A LOT of zeroes (through 97%) and then some more
> Allegro info in the end... What am I missing, some switch or what??? please
> help... thanks...
Hmmm.  I would guess that youve got some really large static arrays in
your code.  Replace them with dynamic ones and the file size should drop
down significantly.  For example:

Change this:
unsigned char big_static_array[3000000];

Into this:
unsigned char *big_dynamic_array;
   .
   .
   .
if(NULL == (big_dynamic_array = (unsigned char *)malloc(3000000)))
{
	fprintf(stderr, "Error: can't malloc()\n");
}

-- 

Mike A. Harris                          
http://www3.sympatico.ca/mharris
My dynamic address:     
http://www3.sympatico.ca/mharris/ip-address.html
mailto:mharris AT sympatico DOT ca       
mailto:mharris AT blackwidow DOT saultc DOT on DOT ca
The Ultimate: Linux 2.0.26, DOSemu, 4DOS 5.50c, DJGPP 2.01, Borland C
3.1

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019