Bad Eggs
Michael Geary | Fri, 2004-09-10 09:12
category
Do you have static objects that dynamically allocate memory at startup and carefully free it when your app exits? I’ve used them in a few projectsmore than I’d want to admit.
If you’re throwing out a carton of bad eggs, you could take the eggs out of the carton and put them in the trash one by one, followed by the empty carton. But it’s quicker and easier to just toss the whole thing in the trash.
Static objects are bad eggs.
I suppose the C++ runtime has to toss them all in the trashcall their destructorsbecause it doesn’t know if those destructors really need to be run. But if they’re just going to free memory there ought to be some way to skip all that.