Original Post
I have an object in global space. Some of it's members have allocations which are freed on destruction. But I also have a memory manager that alerts me to leaks or other errors, and this is summed up at the end of my Main() function. The problem is that my global space object won't have it's destructor called until after main has exited, and my memory manager will most likely throw a fit, thinking all of that data is going to be left in memory. I could create a Free() type function for the global object. But it would be a hassle freeing each attribute in that function, where the destructor handles it all automatically. So is it a problem to call Object.~ClassName(); at the end of main? Or is that just a bad idea? I would hate to have to allocate this object in main, but if this is a problem, that's most likely what I'll do. I've never called destructors manually, so I don't know if some whacky memory swipe routine will chew up my application or not. Do destructors do anything other than the code you specify in them? I mean are there any hidden routines running in between the lines? Thanks for any help edit: Just in case it makes a difference, the global object is a simple structure. It actually doesn't even define it's own destructor. So the built in one would be called.