[OT]-ish: Can someone explain this?

Andrew Suffield asuffield at suffields.me.uk
Mon Jul 4 20:25:51 BST 2011


On Mon, Jul 04, 2011 at 09:00:17PM +0200, Paul Johnson wrote:
> If you have a program which allocates large dynamic data structures,
> cleaning up those structures when the program terminates can be quite
> expensive.  Judicious use of _exit(), particularly in C++, can (could?)
> be the difference between a program ending almost immediately and a very
> noticeable delay.

In C it shouldn't matter because exit() doesn't deallocate anything
(assuming nobody did anything foolish with atexit()). Static
destructors in C++ are more interesting - but if I were to find myself
with a problem like that, my first thought would be "stop using a
static destructor and just lose a pointer".

I guess if you're stuck with a third-party library then this could
become a problem. Any other cases?


More information about the london.pm mailing list