Ignore:
Timestamp:
12/09/21 12:28:20 (3 years ago)
Author:
ymipsl
Message:

Tracking memory leak : release memory statically alocated

YM

Location:
XIOS/dev/dev_ym/XIOS_COUPLING/src/manager
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/pool_ressource.cpp

    r2260 r2274  
    118118      if (it->second->eventLoop(serviceOnly)) 
    119119      { 
     120        delete it->second ; 
    120121        services_.erase(it) ; 
    121122        // don't forget to free service later 
     
    196197    finalizeSignal_=true ; 
    197198    for (auto it=services_.begin(); it!=services_.end() ; ++it) it->second->finalizeSignal() ; 
    198   } 
    199  
     199  }   
     200   
     201  CPoolRessource::~CPoolRessource() 
     202  { 
     203    delete winNotify_ ; 
     204    for(auto& service : services_) delete service.second ; 
     205  } 
    200206} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/pool_ressource.hpp

    r2260 r2274  
    2323   public: 
    2424    CPoolRessource(MPI_Comm poolComm, const std::string& Id) ; 
     25    ~CPoolRessource() ; 
    2526     
    2627    void createService(const std::string& serviceId, int type, int size, int nbPartition) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/server_context.cpp

    r2265 r2274  
    5454  CServerContext::~CServerContext() 
    5555  { 
    56  
     56    cout<<"Server Context destructor"<<endl; 
    5757  }  
    5858 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/server_context.hpp

    r2260 r2274  
    1919                  const int& partitionId, const std::string& contextId) ; 
    2020    ~CServerContext() ; 
     21    static void releaseStaticAllocation(void) { overlapedComm_.clear() ;} 
    2122 
    2223    bool createIntercomm(const string& poolId, const string& serviceId, const int& partitionId, const string& contextId,  
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/servers_ressource.cpp

    r2260 r2274  
    131131      if (poolRessource_->eventLoop(serviceOnly)) 
    132132      { 
     133        delete poolRessource_ ; 
    133134        poolRessource_=nullptr ; 
    134135        // don't forget to free pool ressource later 
     
    188189    else return false ; 
    189190  } 
     191 
     192  CServersRessource::~CServersRessource() 
     193  { 
     194    delete winNotify_ ; 
     195  } 
    190196} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/servers_ressource.hpp

    r2260 r2274  
    2424     
    2525    CServersRessource(MPI_Comm serverComm) ; 
     26    ~CServersRessource() ; 
    2627    void createPool(const string& poolId, const int size) ; 
    2728    void createPool(void) ; 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.cpp

    r2260 r2274  
    4242    name_= poolId+"::"+serviceId+"_"+oss.str(); 
    4343  } 
     44 
     45  CService::~CService() 
     46  { 
     47    delete eventScheduler_ ; 
     48    delete winNotify_ ; 
     49    for(auto& it : contexts_) delete it.second ; 
     50  } 
     51 
    4452 
    4553  void CService::createContext( const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) 
     
    121129      if (it->second->eventLoop(serviceOnly)) 
    122130      { 
     131        delete it->second ;  
    123132        contexts_.erase(it) ; 
    124133        // destroy server_context -> to do later 
     
    235244     auto& arg=notifyInCreateContext_ ; 
    236245     string poolId = get<0>(arg) ; 
    237      string& serviceId = get<1>(arg) ; 
     246     string serviceId = get<1>(arg) ; 
    238247     int partitionId = get<2>(arg) ; 
    239248     string contextId = get<3>(arg) ; 
    240      contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ;  
     249     contexts_[contextId] = new CServerContext(this, serviceComm_, poolId, serviceId, partitionId, contextId) ; 
    241250   } 
    242251 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/manager/services.hpp

    r2260 r2274  
    2121    CService(MPI_Comm serviceComm, const std::string& poolId, const std::string& serviceId, const int& partitionId,  
    2222             int type, int nbPartitions) ; 
     23    ~CService() ; 
     24 
    2325    bool eventLoop(bool serviceOnly=false) ; 
    2426    void createContext(const std::string& poolId, const std::string& serviceId, const int& partitionId, const std::string& contextId) ; 
Note: See TracChangeset for help on using the changeset viewer.