Boost logo

Boost Users :

From: Jens Theisen (jth01_at_[hidden])
Date: 2006-01-24 13:33:00

monade wrote:

> Ok, it may be no memory leak, but only a harmless resource leak (as
> Alexandrescu calls it in his singleton chapter), but I don't like it
> anyway (my own singletons does not leak).

If there would be a delete in the destructor, you would not gain anything:
The destructor of a singleton is conceptually called on program
termination and that's also where all resources are freed by the operating
system anyway. So it's perfectly reasonable to not free it.

I think the benefit has to do with that the object would otherwise be
destroyed at a point which may be too early (if it was constructed too
late), though I say anything about the thread library code in particular.

> It's not a problem of VLD, every memory leak detecting tool I used
> reported leaks with the test code.

Surely not all will, and since it's not a leak at all, it should not be

> So I can't get used to this kind of harmless leak.

Since I'm not a contributer of boost it's not arrogance to say that the
general quality of these libaries is really high. I'm inclined to say that
you'll find it very difficult to find a bug in them and especially the
threads library seems to disallow some dangerous constructs allowed in
other libraries.

In the presence of these benefits I advise to live with what seems to be
an asthetical problem to me.


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at