This is the mail archive of the libstdc++@gcc.gnu.org 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: Memory Leak using STL - gcc-3.2 and gcc-2.95.3


On Sat, Oct 05, 2002 at 01:14:37AM +0000, Stefan Jones wrote:
> It just makes programs less elegant from the
> malloc/free pair-up point of view. 

Unless you're doing embedded programming, there is often a relatively
large amount of memory allocated but never freed, precisely because...

> The "solution" would be to make it get freed on program exit, but that
> would serve no purpose except from an artistic view point.

.../all/ memory is freed -- returned to the system -- on program exit.

Whether the memory is kept around in a pool, or actually leaked (i.e.,
misplaced and forgotton about) doesn't matter once the program exits.
The operating system gets it all back.

Many system libraries don't bother freeing memory that they know will be
around until termination, because it would be a waste of cpu cycles.


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002


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