This is the mail archive of the mailing list for the libstdc++ project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Libstdc++-v3 memory leakage?

On Tue, Mar 11, 2003 at 06:47:20PM -0600, Benjamin Kosnik wrote:

> >I'd also support Jonathan Wakely updating the documentation before the
> >3.3 release (he volunteered in this thread).  In particular, I'd love
> >a new section:
> >
> >How do I check to see if there is a library memory leak with my
> >application before I report it? (suggested topics in addition to
> >Jonathan's own ideas:)
> >
> >-discussion of setting environment variable to disable pool allocator
> >-discussion of one-shot code displaying a "leak" doesn't really cut it
> > (related to any service in the libary that maintains state or a cache)

> >I'd be happy to review and/or commit such improvements to the
> >documentation.

See attached patch for my suggested changes.
It adds these memory leaks to "things that look like bugs...", briefly
explaining the situation and referencing the "tips for memory leak
hunting" section pointed out by Benjamin, which already discusses how
to disable the pool allocator.

> see "Tips for memory leak hunting," which obviously needs work.

I also fixed some XHTML errors and replaced some absolute URIs with
relative ones (for offline viewing) and added a few more words explaining
that the memory is still in use, to clarify that we're not just ignoring
leaks on the basis that the memory will be returned on termination anyway
("hey, just buy more RAM" ;-)
The relevant bit of the patch is:

 <p>In a nutshell, the default allocator used by <code>
    std::allocator</code> is a high-performance pool allocator, and can
    give the mistaken impression that memory is being leaked, when in
-   reality the memory is reclaimed after program termination.
+   reality the memory is still being used by the library and is reclaimed
+   after program termination.

There's currently nothing in the docs explaining that a one-off leak of
a constant amount is not a leak, I like Loren's explanation in but I'm not sure
it needs covering in the docs. Whaddya reckon?

Aside: am I good to commit without approval when I find XHTML errors and
don't change any text, just make the markup valid?  (i.e. I've found some
and don't want to bore the list just to please XHTML validators)


I don't pretend to be an expert on intellectual property law, but I do
know one thing. If a music industry executive claims I should agree with
their agenda because it will make me more money, I put my hand on my wallet
... and check it after they leave, just to make sure nothing's missing.
	- Janis Ian <>

Attachment: libstdc++-docs-leaks.patch
Description: Text document

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]