Does anyone know when or if destructors for statically declared
objects are called? I am just wondering if I am leaking system
resources each time i exit my program.
It depends on how you exit the program. If you call abort, then "no" is
the answer. If you either call 'exit', or fall off the end of 'main'
(which eventuall calls 'exit'), then the answer is "yes". If you
terminate in any other fashion, then you're on your own...
3.6.3p1 says:
,----
| Destructors (12.4) for initialized objects of static storage duration
| (declared at block scope or at namespace scope) are called as a result
| of returning from main and as a result of calling exit (18.3). These
| objects are destroyed in the reverse order of the completion of their
| constructor or of the completion of their dynamic initialization. If an
| object is initialized statically, the object is destroyed in the same
| order as if the object was dynamically initialized. For an object of
| array or class type, all subobjects of that object are destroyed before
| any local object with static storage duration initialized during the
| construction of the subobjects is destroyed.
`----
Regards,
Andy S