www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/11/08/23:17:01

Sender: nate AT cartsys DOT com
Message-ID: <36466BCF.6689373B@cartsys.com>
Date: Sun, 08 Nov 1998 20:13:03 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.05 [en] (X11; I; Linux 2.0.35 i486)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Memory Usage
References: <36461FCD DOT FF523139 AT mayn DOT de>
Reply-To: djgpp AT delorie DOT com

Christian Herold wrote:
> 
> Hello!
> 
> Is there a utility wich shows me how much memory my c++ (including
> variables and consts) takes?

Hmm... you can find the size of all code and statically allocated data
with the `size' command on your executable.  The fields, in bytes, are
as follows:

`text'	Code and most read-only data (like string literals) (in C anyway,
C++ may be different)
`data'  Read/write initialized data (like `char a[5] = "Foo";');
`bss'   Read/write uninitialized data (like `char a[5];')
`dec'	Total in decimal
`hex'	Total in hex

As for dynamically allocated data, it may be best to use a memory
analysis/debugging package like MSS, which will give you more statistics
about dynamic memory usage than you ever wanted. :)
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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