Bug 2697 - Suggestion for future DAnCE refactoring
Summary: Suggestion for future DAnCE refactoring
Status: RESOLVED DUPLICATE of bug 3590
Alias: None
Product: CIAO
Classification: Unclassified
Component: DAnCE (show other bugs)
Version: 0.5.3
Hardware: All All
: P3 normal
Assignee: Will Otte
URL:
Depends on:
Blocks: 2801 3253
  Show dependency tree
 
Reported: 2006-11-03 08:56 CST by Abdul Sowayan
Modified: 2009-02-23 06:28 CST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Abdul Sowayan 2006-11-03 08:56:07 CST
I'm putting this in bugzilla so we can remember to do something about this 
when we refactor DAnCE.

---------------------------------
CIAO Version: 0.5.3

Area Affected:
$CIAO_ROOT\DAnCE\TargetManager\DomainDataManager.cpp

Descripton:

My apologies before hand if this is a dumb question. I didn't have much to 
research this. I came across the following code by accident:

//static variable
CIAO::DomainDataManager* CIAO::DomainDataManager::global_data_manager_ = 0;

CIAO::DomainDataManager * CIAO::DomainDataManager::create (CORBA::ORB_ptr orb,
                            ::Deployment::TargetManager_ptr target
                            )
{
  if (global_data_manager_ == 0)
    {
      global_data_manager_ = new DomainDataManager (orb , target);
    }
  return global_data_manager_;
}

The intent of the above code is to have a singleton, right? This code has the 
problem that two instances of DomainDataManager might be created, and only one 
destroyed, which will result in a memory leak.

We really should be using the Double-Checked Locking Optimization pattern to 
prevent the problem I described above from happening. This is similar to what 
is done in ACE_Thread_Manager::instance() method.

------------------------------------------------------

Hi Abdul,

   Right, I agree with you.  Will, can you please make sure we add this 
enhancement during the DAnCE refactoring?

Thanks,

        Doug
Comment 1 Johnny Willemsen 2006-11-03 12:41:35 CST
to will
Comment 2 Will Otte 2007-02-08 14:38:41 CST
Updated component.
Comment 3 Johnny Willemsen 2009-02-23 06:28:56 CST
duplicate of new bug that is based on svn head

*** This bug has been marked as a duplicate of bug 3590 ***