help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Custom new/delete and STL


From: starkos
Subject: Custom new/delete and STL
Date: 5 Sep 2005 17:16:09 -0700
User-agent: G2/0.2

I am trying to integrate a third-party library into an existing
project. All memory allocations must be routed through a custom memory
manager (not my choice). Also, it must be possible to "close" a session
and release all resources, without actually exiting the process. The
third party library uses the STL. We have the source code for the
library but would prefer not to modify it unless absolutely necessary.

On the Windows port, I overloaded new() and delete() and everything is
fine. So long as all STL objects go out of scope at the end of the
session every memory allocation has a matching release.

On the Linux port, this is not the case. I see calls to new() with no
matching call to delete(). I have seen several posts on this list
mention the issue, but I'm still a bit fuzzy about what is going on.
I'm still looking through the source code -- I am not an expert on GCC
or Linux for that matter by any means. It appears that some static
memory is allocated and kept for the lifetime of the process, which
would really screw me up.

Am I right? Is that the case, or is memory being released via some
other method? Although I can probably guess at the answer, is there a
way force the g++ STL to match up the new/deletes? I checked the FAQ
but didn't see anything. This is for GCC (3.3.5).

Thanks for the help,
Jason



reply via email to

[Prev in Thread] Current Thread [Next in Thread]