Boost Users :
From: Seweryn Habdank-WojewÃ³dzki (shw_at_[hidden])
Date: 2007-05-28 10:25:42
> 'possibly lost' seems less than conclusive that there's actually a leak.
Yes I know, but sometimes it is possible to eliminate them completely, even
if "variable" exists until the end of the program.
Especially If the program is written in C++. In C++ where you have RAII, and
you can control static initialisation and destruction there is an opportunity
to release all resources.
Some months ago I have developed simple logger (http://cxxtl.sf.net) and there
I had a problem that resources of logger HAVE TO stay in memory until the
last usage of logger is finished even if it is in statically allocated class
Logger produce something like below.
foo.cpp  : Creation of the foo object.
main.cpp  : Trivial logger in main().
main.cpp  : atexit()->finalize()->EXIT_SUCCESS
foo.cpp  : Destruction of the foo object.
Logger observe atexit function.
Logger even can observe final destructions.
And valgrind do not report any leak:
==24722== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 7 from 1)
==24722== malloc/free: in use at exit: 0 bytes in 0 blocks.
==24722== malloc/free: 8 allocs, 8 frees, 8,870 bytes allocated.
==24722== For counts of detected errors, rerun with: -v
==24722== All heap blocks were freed -- no leaks are possible.
So sometimes it is possible to eliminate possible leaks (cause they are at the
end of the program). If in your case it is possible to eliminate this from
the code I willbe grateful for that, if not, I understand, because In my
logger I had similar problem.
-- |\/\/| Seweryn Habdank-WojewÃ³dzki \/\/
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net