delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/20/23:00:24

From: "John M. Aldrich" <fighteer AT cs DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: 3k lines = 4 MEG!! EXE ?? Help
Date: Tue, 20 Jan 1998 22:54:20 -0500
Organization: Two pounds of chaos and a pinch of salt.
Lines: 28
Message-ID: <34C5716C.541A@cs.com>
References: <34C4B1C1 DOT 51D2 AT netunlimited DOT net>
NNTP-Posting-Host: ppp240.cs.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

gilley wrote:
> 
>        version 3,  3000 lines of code + Allegro + lots of globals
>                    used in testing + 500 lines of "model data"
>                    consisting of initialized structures that hold
>                    the 3d models.  = 4 MEG exe.
> 
>        Running strip on the 4 Meg exe gets me a 3.9 meg exe.
> 
>        What is going on here? What has caused the exe to jump to 4 megs?

If you are using C++, then the answer is simple:  gcc builds static
arrays into the executable when compiling a C++ program.  If you declare
something like:

static int global_array[1000][1000];

All 4 megabytes of the array will be included in the executable file. 
See chapter 8.14 of the DJGPP FAQ for precise details and instructions
on how to keep this from happening.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       |"Men rarely (if ever) manage to dream |
|       aka Fighteer I       |up a god superior to themselves. Most |
|   mailto:fighteer AT cs DOT com   |gods have the manners and morals of a |
| http://www.cs.com/fighteer |spoiled child."    - Lazarus Long     |
---------------------------------------------------------------------

- Raw text -


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