singleton and memory leak

Hello ,

Do you hear about memory leak bent to the use
Of the singleton of Ace(5.2)
Class T
     friend class ACE_Singleton<T, ACE_Recursive_Thread_Mutex>;

T ( ) {};

typedef ACE_Singleton<T, ACE_Recursive_Thread_Mutex> TSingleton;

P.S : we’re working multi_thread.

Thanks by advance.
Who is Participating?
MindphaserConnect With a Mentor Commented:
NathalieB provided her own solution. I will refund the points and move the question to PAQ.
** Mindphaser - Community Support Moderator **
I had a problem once associated with singletons and apparent memory leaks. The problems was due to the fact that once a singleton is created, the housing doesn't destroy it on the last release incase someone else is going to want it. There is quite a long timeout period before it really is disgarded, from memory I got the housing to behave closer to my expectations by changing the following line

const DWORD dwTimeOut = 0; // was 5000; // time for EXE to be idle before shutting down

This may not be your problem - but worth a try.

I once had a similar problem.  The leak reporting was occurring before the destructors were called.  A leak was reported but it was not a leak.  You can confirm this by putting a breakpoint on the destructor.  If you see leaks reported already when the breakpoint is hit, you had the same "phantom" leaks.
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

NathalieBAuthor Commented:
It's true.
The leak occures before the calling to the cleanup
function(/* delete this;...*/)!!!!!!!
Do i have to accuse
    my code : sequence of calling functions,
    the boundschecker,
    or the type of singleton that we chose ?
So, there is no leak?  Then the fault lies with the reporting.

You can eliminate this from reporting by using CNoTrackObject or other ways to get the reporting of the leak to stop.
Did you try changing the timeout value as I suggested?
Is it an Exe or Dll housing?
NathalieBAuthor Commented:
it's a exe housing.
Sorry,The time has no influence in this phenomena.
I "solve" the problem with an not casher solution:
i call to my cleanup objects,
and to the explicit destructor:
the ACE_Object_Manager::instance()->fini();
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.