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

Bug#224735: libstdc++5-3.3-dev: Leaks in string allocation?



close 224735
thanks

Hola Daniel Jacobowitz!

> The string class does manage a certain amount of memory on its own.  I
> seem to recall this fooling memory leak analyzers before.

Actually this seems to be the case, although it's not only the string
class, but the whole STL. This was brought to my attention by Jeremy
Nimmer.

Taken from the GCC docs [1]:

 In use, std::allocator may allocate and deallocate using
 implementation-specified strategies and heuristics. Because of this,
 every call to an allocator object's allocate member function may not
 actually call the global operator new. This situation is also
 duplicated for calls to the deallocate member function.

 In particular, this can make debugging memory errors more difficult,
 especially when using third party tools like valgrind or debug
 versions of new.

This can be solved in 3.3 by setting an environment value:
GLIBCPP_FORCE_NEW, with this variable, forcing allocate to directly
allocate, and deallocate to directly deallocate, regardless of
efficiency.

Therefore, this does not seem to be a bug, and I'm closing it.

[1] http://gcc.gnu.org/onlinedocs/libstdc++/20_util/allocator.html#forcenew

Love,
Margarita.



Reply to: