From 4189383032900273809
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,595bb1616731f165
X-Google-Attributes: gidf78e5,public
From: "Bill Wade" <bill.wade@stoner.com>
Subject: Re: Determine Memory overhead of Objects?
Date: 1999/11/02
Message-ID: <7vlb8t$p5g@library1.airnews.net>#1/1
X-Deja-AN: 543384384
Approved: Fergus Henderson <fjh@cs.mu.oz.au>
References: <ufzox0zxvr.fsf@fusebox.hanse.de>
X-Original-Date: Mon, 1 Nov 1999 16:59:35 -0600
X-Mimeole: Produced By Microsoft MimeOLE V4.72.3110.3
X-Complaints-To: news@news.unimelb.edu.au
X-Trace: ariel.ucs.unimelb.edu.au 941518427 7188 128.250.37.153 (2 Nov 1999 04:53:47 GMT)
Organization: Neosoft (using Airnews.net!)
X-Auth: PGPMoose V1.1 PGP comp.std.c++ iQBFAgUAOB5uU+EDnX0m9pzZAQHxtQF/cBaz2t0jHaJEK272pY5sxtSKVnOTthSF iWFanJK118cIhyP1tUn+5rB194s4XPJ0 =XpQQ
NNTP-Posting-Date: 2 Nov 1999 04:53:47 GMT
Abuse-Reports-To: abuse at airmail.net to report improper postings
Newsgroups: comp.std.c++

Georg C. F. Greve wrote in message ...
>It is common knowledge that every allocation carries a certain bit of
>overhead - meaning the memory "above" the actual memory that carries
>internal system information.
>
>As far as I know this is usually a system-dependant, constant amount
>(if that should be wrong, please tell me)

This is common, but there are plenty of exceptions.  For small objects that
don't need to be padded there are strategies that have an amortized overhead
of only a few percent of the object's size.  Many systems will pad a user
requested size to some larger number (say a generalized alignment number or
a power of two) before or after adding overhead for each object.  Some
debugging allocators will save the current call stack associated with each
allocated block.  This implies that the overhead is proportional to the call
depth.

> - is there any clean,
>"standardized" way of retrieving the size of this overhead?

The short answer is no.  Talk to your vendor or to a system-specific news
group to get answers, or use a debugger that really lets you see what is
going on.
---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]



