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/node
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.cpp

    r2267 r2274  
    5959   } 
    6060   CATCH 
     61    
     62   void CAxis::releaseStaticAllocation(void) 
     63   { 
     64     transformationMapList_.clear() ; 
     65     CTransformation<CAxis>::unregisterAllTransformations() ; 
     66     CGridTransformationFactory<CAxis>::unregisterAllTransformations() ; 
     67   } 
    6168 
    6269   ///--------------------------------------------------------------- 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp

    r2270 r2274  
    2323#include "distribution_type.hpp" 
    2424#include "generic_algorithm_transformation.hpp" 
     25#include "grid_transformation_factory_impl.hpp" 
    2526 
    2627 
     
    6869         CAxis(const CAxis & axis);       // Not implemented yet. 
    6970         CAxis(const CAxis * const axis); // Not implemented yet. 
     71         static void releaseStaticAllocation(void) ; // release static allocation on heap 
    7072 
    7173         static CAxis* createAxis(); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.cpp

    r2265 r2274  
    6363     for (std::vector<CContextClient*>::iterator it = clientPrimServer.begin(); it != clientPrimServer.end(); it++)  delete *it; 
    6464     for (std::vector<CContextServer*>::iterator it = serverPrimServer.begin(); it != serverPrimServer.end(); it++)  delete *it; 
    65  
     65     if (registryIn!=nullptr) delete registryIn ; 
     66     if (registryOut!=nullptr) delete registryOut ; 
    6667   } 
    6768 
     
    100101   CATCH 
    101102 
     103   void CContext::releaseStaticAllocation(void) 
     104   TRY 
     105   { 
     106      CDomain::releaseStaticAllocation(); 
     107      CAxis::releaseStaticAllocation(); 
     108      CScalar::releaseStaticAllocation(); 
     109      if (root) root.reset() ; 
     110   } 
     111   CATCH 
     112    
    102113   //---------------------------------------------------------------- 
    103114 
     
    326337  #include "node_type.conf" 
    327338*/ 
     339  CObjectFactory::deleteAllContexts<CContext>() ; 
     340  CObjectFactory::deleteAllContexts<CContextGroup>() ; 
     341  CObjectFactory::clearCurrentContextId(); 
     342  CGroupFactory::clearCurrentContextId(); 
    328343} 
    329344   ///--------------------------------------------------------------- 
     
    538553      if (commRank==0) 
    539554      { 
    540         if (attached_mode) CXios::getContextsManager()->createServerContext(CClient::getPoolRessource()->getId(), CXios::defaultServerId, 0, getContextId()) ; 
     555        if (attached_mode) CXios::getContextsManager()->createServerContext(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId()) ; 
    541556        else if (CXios::usingServer2) CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultGathererId, 0, getContextId()) ; 
    542557        else  CXios::getContextsManager()->createServerContext(CXios::defaultPoolId, CXios::defaultServerId, 0, getContextId()) ; 
     
    547562      if (attached_mode) 
    548563      { 
    549         parentServerContext_->createIntercomm(CClient::getPoolRessource()->getId(), CXios::defaultServerId, 0, getContextId(), intraComm_,  
     564        parentServerContext_->createIntercomm(CClient::getPoolRessource()->getId(), getContextId()+"_"+CXios::defaultServerId, 0, getContextId(), intraComm_,  
    550565                                              interCommClient, interCommServer) ; 
    551566        int type ;  
     
    811826        closeAllFile(); 
    812827        client->releaseBuffers(); 
     828        server->releaseBuffers(); 
    813829      } 
    814830 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/context.hpp

    r2265 r2274  
    8282         /// Destructeur /// 
    8383         virtual ~CContext(void); 
     84 
     85         static void releaseStaticAllocation(void) ; 
    8486 
    8587         //--------------------------------------------------------- 
     
    229231        // Get context root 
    230232        static CContextGroup* getRoot(void); 
    231  
     233        
    232234        // Set current context 
    233235        static void setCurrent(const string& id); 
     
    329331         std::vector<std::string> primServerId_; 
    330332 
    331          CRegistry* registryIn ;    //!< input registry which is read from file 
    332          CRegistry* registryOut ;   //!< output registry which will be written into file at the finalize 
     333         CRegistry* registryIn=nullptr ;    //!< input registry which is read from file 
     334         CRegistry* registryOut=nullptr ;   //!< output registry which will be written into file at the finalize 
    333335 
    334336 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.cpp

    r2267 r2274  
    2525#include "grid_gatherer_connector.hpp" 
    2626#include "transformation_path.hpp" 
     27#include "grid_transformation_factory_impl.hpp" 
    2728 
    2829#include <algorithm> 
     
    6263   } 
    6364 
     65   void CDomain::releaseStaticAllocation(void) 
     66   { 
     67     transformationMapList_.clear() ; 
     68     CTransformation<CDomain>::unregisterAllTransformations() ; 
     69     CGridTransformationFactory<CDomain>::unregisterAllTransformations() ; 
     70   } 
    6471   ///--------------------------------------------------------------- 
    6572 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp

    r2270 r2274  
    7171         CDomain(const CDomain & domain);       // Not implemented yet. 
    7272         CDomain(const CDomain * const domain); // Not implemented yet. 
    73         
     73         static void releaseStaticAllocation(void) ; // release static allocation on heap 
     74 
    7475         static CDomain* createDomain(); 
    7576         static CDomain* get(const string& id, bool noError=false) ; //<! return domain pointer using id 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.cpp

    r2267 r2274  
    3232  { /* Ne rien faire de plus */ } 
    3333 
     34  void CScalar::releaseStaticAllocation(void) 
     35  { 
     36    transformationMapList_.clear() ; 
     37    CTransformation<CScalar>::unregisterAllTransformations() ; 
     38    CGridTransformationFactory<CScalar>::unregisterAllTransformations() ; 
     39  } 
     40   
    3441  std::map<StdString, ETranformationType> CScalar::transformationMapList_ = std::map<StdString, ETranformationType>(); 
    3542  bool CScalar::dummyTransformationMapList_ = CScalar::initializeTransformationMap(CScalar::transformationMapList_); 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp

    r2270 r2274  
    2020#include "distribution_type.hpp" 
    2121#include "generic_algorithm_transformation.hpp" 
     22#include "grid_transformation_factory_impl.hpp" 
    2223 
    2324 
     
    6768      CScalar(const CScalar & var);       // Not implemented yet. 
    6869      CScalar(const CScalar * const var); // Not implemented yet. 
    69  
     70      static void releaseStaticAllocation(void) ; // release static allocation on heap 
     71       
    7072      /// Destructeur /// 
    7173      virtual ~CScalar(void); 
Note: See TracChangeset for help on using the changeset viewer.