Reputation: 119
I have a project that uses TAO(CORBA)'s Naming Service for information exchange between different modules. However, I found that my implementation of the Naming Service caused memorys leak as detected by my memory leak detection software(Parasoft).
For testing purposes, I have created a small sample project.
int main (int argc, ACE_TCHAR ** const argv)
{
std::cout << "start of main" << std::endl;
CORBA::ORB_ptr myOrb = CORBA::ORB_init(argc, argv);
CORBA::release(myOrb);
myORB->destroy();
std::cout << "end of main" << std::endl;
}
When I ran my memory leak detection software, it was discovered that the ORB_init is leaking memory. However, as can be seen form the sample code, all I did was to init an ORB, and release and destroy it immediately after. Are there any other steps to release the ORB allocated resources from within?
One of the leaks:
12 bytes 1 chunk allocated
malloc () (interface)
operator new()
CORBA::string_alloc() String_Alloc.cpp, 53
CORBA::string_dup() String_Alloc.cpp, 38
TAO_Default_Resource_Factory::get parser_names() default_resources.cpp, 590
TAO_Parser_Registry::open() Parser_Registry.cpp, 40
TAO_ORB_Core::init() /home/user/ACE_Wrappers/ace/Arg_Shifter.cpp, 1291
CORBA::ORB_init() ORB.cpp 1359
main() ..src/AlphaTest.cpp, 34
I only have control over src/AlphaTest.cpp, the rest are TAO files.
Upvotes: 1
Views: 361
Reputation: 3002
The leak you show is from a global singleton, that is cleaned at process exit and doesn't increase memory during runtime. Very likely the issue is in your application code, you are very likely not using the CORBA IDL to C++ language mapping correctly. Your example code is not correct in that respect, it should be as following
int main (int argc, ACE_TCHAR * const argv[])
{
std::cout << "start of main" << std::endl;
CORBA::ORB_var myOrb = CORBA::ORB_init(argc, argv);
myORB->destroy();
std::cout << "end of main" << std::endl;
}
Upvotes: 1