Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp	(revision 2242)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp	(revision 2243)
@@ -175,26 +175,4 @@
 
 #endif
-     
-     // Delete CContext
-     xios_map<StdString, xios_map<StdString, std::shared_ptr<CContext> > >* contextMap = CObjectTemplate<CContext>::GetAllMapobject();
-     for(auto it = contextMap->begin(); it != contextMap->end(); ++it)
-     {
-       for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2)
-       {
-           std::shared_ptr<CContext> todel = it2->second;
-           todel.reset();
-       }
-       it->second.clear();
-
-       std::vector<std::shared_ptr<CContext> >*  contextVect = CObjectTemplate<CContext>::GetAllVectobjectPtr(it->first);
-       for(auto it = contextVect->begin(); it != contextVect->end(); ++it)
-       {
-           it->reset();
-       }
-       contextVect->clear();
-       
-     }
-     contextMap->clear();
-     
   }
 
@@ -247,25 +225,4 @@
     report(0)<<CMemChecker::getAllCumulatedMem() ;
     CServer::closeInfoStream();
-    
-    // Delete CContext
-    xios_map<StdString, xios_map<StdString, std::shared_ptr<CContext> > >* contextMap = CObjectTemplate<CContext>::GetAllMapobject();
-    for(auto it = contextMap->begin(); it != contextMap->end(); ++it)
-    {
-      for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2)
-      {
-          std::shared_ptr<CContext> todel = it2->second;
-          todel.reset();
-      }
-      it->second.clear();
-
-      std::vector<std::shared_ptr<CContext> >*  contextVect = CObjectTemplate<CContext>::GetAllVectobjectPtr(it->first);
-      for(auto it = contextVect->begin(); it != contextVect->end(); ++it)
-      {
-          it->reset();
-      }
-      contextVect->clear();
-      
-    }
-    contextMap->clear();
   }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/interface/c/icdata.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/interface/c/icdata.cpp	(revision 2242)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/interface/c/icdata.cpp	(revision 2243)
@@ -146,4 +146,6 @@
      CTimer::get("XIOS finalize").resume();
      CXios::clientFinalize();
+     // Delete CContext
+     CObjectTemplate<CContext>::cleanStaticDataStructure();
    }
    CATCH_DUMP_STACK
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp	(revision 2242)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template.hpp	(revision 2243)
@@ -69,13 +69,9 @@
          static std::vector<std::shared_ptr<DerivedType> > &
             GetAllVectobject(const StdString & contextId);
-         static std::vector<std::shared_ptr<DerivedType> > *
-            GetAllVectobjectPtr(const StdString & contextId);
-
-         static xios_map<StdString, xios_map<StdString, std::shared_ptr<DerivedType> > >*
-            GetAllMapobject();
-
 
          /// Destructeur ///
          virtual ~CObjectTemplate(void);
+         
+         static void cleanStaticDataStructure(void);     
 
          static bool has(const string& id) ;
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp	(revision 2242)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/object_template_impl.hpp	(revision 2243)
@@ -68,16 +68,26 @@
       return (CObjectTemplate<T>::AllVectObj[contextId]);
    }
-   template <class T>
-      std::vector<std::shared_ptr<T> > *
-         CObjectTemplate<T>::GetAllVectobjectPtr(const StdString & contextId)
-   {
-      return &(CObjectTemplate<T>::AllVectObj[contextId]);
-   }
-
-  template <class T>
-      xios_map<StdString, xios_map<StdString, std::shared_ptr<T> > >*
-         CObjectTemplate<T>::GetAllMapobject()
-   {
-      return &(CObjectTemplate<T>::AllMapObj);
+  
+   template <class T>
+      void CObjectTemplate<T>::cleanStaticDataStructure(void)
+   {
+     xios_map<StdString, xios_map<StdString, std::shared_ptr<T> > >* allMap = &(CObjectTemplate<T>::AllMapObj);
+      for(auto it = allMap->begin(); it != allMap->end(); ++it)
+      {
+	for(auto it2 = it->second.begin(); it2 != it->second.end(); ++it2)
+	{
+	  std::shared_ptr<T> todel = it2->second;
+	  todel.reset();
+	}
+	it->second.clear();
+
+	std::vector<std::shared_ptr<T> >* allVect = &(CObjectTemplate<T>::AllVectObj[it->first]);
+        for(auto it = allVect->begin(); it != allVect->end(); ++it)
+        {
+          it->reset();
+        }
+        allVect->clear();
+      }
+      allMap->clear();
    }
 
Index: XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp
===================================================================
--- XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp	(revision 2242)
+++ XIOS/dev/dev_ym/XIOS_COUPLING/src/server.cpp	(revision 2243)
@@ -205,4 +205,7 @@
       }
       CTimer::get("XIOS event loop").suspend() ;
+
+      // Delete CContext
+      CObjectTemplate<CContext>::cleanStaticDataStructure();
     }
 
