From 0425bec4102334cc0046df2321aeee256bb7ce66 Mon Sep 17 00:00:00 2001 From: ribes Date: Tue, 17 Mar 2009 15:42:34 +0000 Subject: [PATCH] - Valgrind issue for Parallel Containers --- src/Container/SALOME_ContainerManager.cxx | 2 ++ src/NamingService/SALOME_NamingService.cxx | 4 ++-- src/NamingService/SALOME_NamingService.hxx | 2 +- .../SALOME_ParallelContainerNodeDummy.cxx | 9 +++++---- .../SALOME_ParallelContainerNodeMpi.cxx | 5 ++--- .../SALOME_ParallelContainerProxyDummy.cxx | 3 ++- .../SALOME_ParallelContainerProxy_i.cxx | 7 ++++++- .../SALOME_ParallelContainer_i.cxx | 11 +++------- .../SALOME_ParallelContainer_i.hxx | 20 ++++++++----------- 9 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/Container/SALOME_ContainerManager.cxx b/src/Container/SALOME_ContainerManager.cxx index e56d42d90..fdf1465b1 100644 --- a/src/Container/SALOME_ContainerManager.cxx +++ b/src/Container/SALOME_ContainerManager.cxx @@ -500,6 +500,8 @@ FindOrStartParallelContainer(const Engines::MachineParameters& params_const, MESSAGE("[FindOrStartParallelContainer] Deploying node : " << name); node->deploy(); } + + MESSAGE ("[FindOrStartParallelContainer] Starting parallel object"); proxy->start(); } catch(CORBA::SystemException& e) diff --git a/src/NamingService/SALOME_NamingService.cxx b/src/NamingService/SALOME_NamingService.cxx index 33e94851b..9b1d479f5 100644 --- a/src/NamingService/SALOME_NamingService.cxx +++ b/src/NamingService/SALOME_NamingService.cxx @@ -67,7 +67,7 @@ SALOME_NamingService::SALOME_NamingService() SALOME_NamingService::SALOME_NamingService(CORBA::ORB_ptr orb) { MESSAGE("SALOME_NamingService creation"); - _orb = orb ; + _orb = CORBA::ORB::_duplicate(orb); _initialize_root_context(); } @@ -99,7 +99,7 @@ void SALOME_NamingService::init_orb(CORBA::ORB_ptr orb) MESSAGE("SALOME_NamingService initialisation"); Utils_Locker lock (&_myMutex); - _orb = orb; + _orb = CORBA::ORB::_duplicate(orb); _initialize_root_context(); } diff --git a/src/NamingService/SALOME_NamingService.hxx b/src/NamingService/SALOME_NamingService.hxx index daa5ca636..6e54c5f7d 100644 --- a/src/NamingService/SALOME_NamingService.hxx +++ b/src/NamingService/SALOME_NamingService.hxx @@ -94,7 +94,7 @@ public: protected: Utils_Mutex _myMutex; - CORBA::ORB_ptr _orb; + CORBA::ORB_var _orb; CosNaming::NamingContext_var _root_context, _current_context; void _initialize_root_context(); diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx index 55dd65ad4..30bacde22 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeDummy.cxx @@ -148,7 +148,7 @@ int main(int argc, char* argv[]) system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); + SALOME_NamingService * ns = new SALOME_NamingService(orb); // Get the proxy string proxyNameInNS = ns->BuildContainerNameForNS(containerName.c_str(), hostname.c_str()); @@ -161,9 +161,8 @@ int main(int argc, char* argv[]) proxy_ior, myid, root_poa, - (char*) node_name.c_str(), - containerName, - argc, argv); + node_name, + containerName); // PaCO++ init paco_fabrique_manager * pfm = paco_getFabriqueManager(); pfm->register_com("dummy", new paco_dummy_fabrique()); @@ -188,6 +187,8 @@ int main(int argc, char* argv[]) PyGILState_Ensure(); //Delete python container that destroy orb from python (pyCont._orb.destroy()) Py_Finalize(); + delete proxy_ior; + delete ns; } catch (PaCO::PACO_Exception& e) { diff --git a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx index 72354a0ac..082c3f263 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerNodeMpi.cxx @@ -198,9 +198,8 @@ int main(int argc, char* argv[]) proxy_ior, myid, root_poa, - (char*) node_name.c_str(), - containerName, - argc, argv); + node_name, + containerName); // PaCO++ init paco_fabrique_manager * pfm = paco_getFabriqueManager(); pfm->register_com("mpi", new paco_mpi_fabrique()); diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx index 4ff59ce23..24fd47a00 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxyDummy.cxx @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) system(aCommand); #endif - SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb)); + SALOME_NamingService * ns = new SALOME_NamingService(orb); // Engines::Container_proxy_impl * proxy = // new Engines::Container_proxy_impl(orb, // new paco_omni_fabrique()); @@ -128,6 +128,7 @@ int main(int argc, char* argv[]) ns->Register(pCont, _containerName.c_str()); pman->activate(); orb->run(); + delete ns; } catch (PaCO::PACO_Exception& e) { diff --git a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx index fe7931499..dff3bac81 100644 --- a/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainerProxy_i.cxx @@ -47,7 +47,12 @@ Container_proxy_impl_final::Container_proxy_impl_final(CORBA::ORB_ptr orb, _NS->init_orb(_orb); } -Container_proxy_impl_final:: ~Container_proxy_impl_final() {} +Container_proxy_impl_final:: ~Container_proxy_impl_final() { + if (_id) + delete _id; + if (_NS) + delete _NS; +} void Container_proxy_impl_final::Shutdown() diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx index d2dd64ebd..8c4c5dbc9 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.cxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.cxx @@ -76,11 +76,9 @@ Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, char * ior, int rank, PortableServer::POA_ptr poa, - char *containerName, + std::string containerName, std::string proxy_containerName, - int argc , char* argv[], - bool isServantAloneInProcess - ) : + bool isServantAloneInProcess) : InterfaceParallel_impl(orb,ior,rank), Engines::PACO_Container_serv(orb,ior,rank), Engines::PACO_Container_base_serv(orb,ior,rank), @@ -90,8 +88,6 @@ Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, { // Members init _pid = getpid(); - _argc = argc ; - _argv = argv ; _hostname = Kernel_Utils::GetHostname(); _orb = CORBA::ORB::_duplicate(orb); _poa = PortableServer::POA::_duplicate(poa); @@ -104,9 +100,8 @@ Engines_Parallel_Container_i::Engines_Parallel_Container_i (CORBA::ORB_ptr orb, // Adding this servant to SALOME _NS = new SALOME_NamingService(); _NS->init_orb(_orb); - _containerName = _NS->BuildContainerNameForNS(containerName, _hostname.c_str()); + _containerName = _NS->BuildContainerNameForNS(containerName.c_str(), _hostname.c_str()); _proxy_containerName = proxy_containerName; - //_NS->Register(container_node, _containerName.c_str()); // Init Python container part CORBA::String_var sior = _orb->object_to_string(container_node); diff --git a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx index 251941f92..7bf0b9182 100644 --- a/src/ParallelContainer/SALOME_ParallelContainer_i.hxx +++ b/src/ParallelContainer/SALOME_ParallelContainer_i.hxx @@ -60,12 +60,14 @@ class CONTAINER_EXPORT Engines_Parallel_Container_i: virtual public PortableServer::RefCountServantBase { public: - Engines_Parallel_Container_i(CORBA::ORB_ptr orb, char * ior, int rank, - PortableServer::POA_ptr poa, - char * containerName , - std::string proxy_containerName, - int argc, char* argv[], - bool isServantAloneInProcess = true); + Engines_Parallel_Container_i(CORBA::ORB_ptr orb, + char * ior, + int rank, + PortableServer::POA_ptr poa, + std::string containerName , + std::string proxy_containerName, + bool isServantAloneInProcess = true); + virtual ~Engines_Parallel_Container_i(); // --- CORBA methods @@ -126,10 +128,6 @@ public: static void decInstanceCnt(std::string genericRegisterName); // --- needed for parallel components, Numerical Platon - - int getArgc() { return _argc; } - char **getArgv() { return _argv; } - void set_id(PortableServer::ObjectId * id) { _id = id;} Engines::fileRef_ptr createFileRef(const char* origFileName); @@ -149,8 +147,6 @@ protected: PortableServer::POA_var _poa; PortableServer::ObjectId * _id; int _numInstance; - int _argc; - char** _argv; CORBA::Long _pid; bool _isServantAloneInProcess; Engines::fileTransfer_var _fileTransfer; -- 2.39.2