2 Replies Latest reply: Jan 24, 2012 9:25 AM by Mfalco-Oracle RSS

    Reg Purify memoery leak with libcoherence.so

    885603
      We used libcoherence.so library with our c++ code. But we are getting few memory leak issue while running with coherence lib.

      Our memory leak tool : Purify 7.0.1
      Environment - solaris 10 - studio 12

      Just we initialized by passing 2 xml file name instead of using environment variables.

      Our code looks like below
      /************************************************************************************************
      * Method Name : InitConfigXMLFile *
      * Usage : This method is used to load coherence config files *
      * *
      *************************************************************************************************/

      int gridConfig::InitConfigXMLFile(std::string cacheConfigXml, std::string overrideConfigXml)
      {
      std::string debugTraceTxt="";
      try {
      debugTraceTxt="CFG Error in" + cacheConfigXml ;
      CacheFactory::configure(CacheFactory::loadXmlFile(String::create(cacheConfigXml)),CacheFactory::loadXmlFile(String::create(overrideConfigXml)));
      v_SetError(MISC_DEBUG_INFO, ERR_LOCATION, "NETX_COH_INFO : Coherence Cache Initilaized Successfully",NULL );

      }
      catch(const std::exception& e) {

      ==========================================================================================================


      Could you help to resolve those issues. there is no insert / update opeartion done. before that we got the below leaks.


      We got below memory leaks


      PLK: 516 bytes potentially leaked at 0x1e1c978
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::util::SafeHashMap::SafeHashMap(unsigned,float,float) [libcoherence.so]
      coherence::net::internal::ScopedReferenceStore::ScopedReferenceStore() [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory::DefaultConfigurableCacheFactory(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]

      PLK: 516 bytes potentially leaked at 0x1e1c720
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::util::SafeHashMap::SafeHashMap(unsigned,float,float) [libcoherence.so]
      coherence::net::internal::ScopedReferenceStore::ScopedReferenceStore() [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory::DefaultConfigurableCacheFactory(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]

      PLK: 516 bytes potentially leaked at 0x1c7c498
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::util::SafeHashMap::SafeHashMap(unsigned,float,float) [libcoherence.so]
      coherence::net::__unnamed_$sTlKDIsbN0DC::MemberConfig*coherence::lang::factory<coherence::net::__unnamed_$sTlKDIsbN0DC::MemberConfig>::create() [libcoherence.so]
      coherence::lang::TypedHandle<coherence::net::__unnamed_$sTlKDIsbN0DC::MemberConfig>coherence::net::__unnamed_$sTlKDIsbN0DC::getMemberConfig() [libcoherence.so]

      PLK: 516 bytes potentially leaked at 0x1c42dc0
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::util::SafeHashMap::SafeHashMap(unsigned,float,float) [libcoherence.so]
      coherence::lang::TLSManager::TLSManager() [libcoherence.so]
      void coherence::lang::TLSManager::ensure() [libcoherence.so]

                

      PLK: 512 bytes potentially leaked in 4 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::String::StringHandle<coherence::lang::String>coherence::lang::String::create(coherence::lang::SubscriptHandle<const coherence::lang::Array<unsigned char>
      ,const unsigned char,unsigned>,unsigned,unsigned) [libcoherence.so]
      coherence::lang::String::StringHandle<const coherence::lang::String>coherence::lang::String::substring(unsigned,unsigned)const [libcoherence.so]
      coherence::lang::TypedHandle<coherence::dev::compiler::Script>coherence::dev::compiler::SimpleScript::subScript(coherence::lang::TypedHandle<const coherence::dev::compile
      r::ParsePosition>)const [libcoherence.so]
      coherence::lang::TypedHandle<const coherence::dev::compiler::Token>coherence::run::xml::XmlTokenizer::eatOutside() [libcoherence.so]
      * Block of 128 bytes (4 times); last block at 0x1e0f8f8

      PLK: 492 bytes potentially leaked at 0x1ddd430
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::util::CircularArrayList::CircularArrayList(unsigned) [libcoherence.so]
      coherence::run::xml::SimpleElement::SimpleElement(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      coherence::run::xml::SimpleDocument::SimpleDocument(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]

      PLK: 488 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::run::xml::SimpleElement*coherence::lang::factory<coherence::run::xml::SimpleElement>::create<coherence::lang::String::StringHandle<const coherence::lang::Strin
      g> >(__type_1&) [libcoherence.so]
      coherence::lang::TypedHandle<coherence::run::xml::XmlElement>coherence::run::xml::SimpleElement::addElement(coherence::lang::String::StringHandle<const coherence::lang::S
      tring>) [libcoherence.so]
      void coherence::run::xml::SimpleParser::parseElement(coherence::lang::TypedHandle<coherence::run::xml::XmlElement>) [libcoherence.so]
      void coherence::run::xml::SimpleParser::parseDocument(coherence::lang::TypedHandle<coherence::run::xml::XmlDocument>) [libcoherence.so]
      * Block of 244 bytes (2 times); last block at 0x1de7940

      PLK: 420 bytes potentially leaked at 0x1c6b118
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::lang::SubscriptHandle<const coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,const coherence::lang::MemberHolder<coherence::lang
      ::Object>,unsigned>coherence::util::filter::__unnamed_$sTlKDEsbNEvA::_createPlanN... [libcoherence.so]
      coherence::lang::SubscriptHandle<const coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,const coherence::lang::MemberHolder<coherence::lang
      ::Object>,unsigned>coherence::util::filter::__unnamed_$sTlKDEsbNEvA::getPlanNames() [libcoherence.so]
      __SLIP.INIT_B [libcoherence.so]

      PLK: 412 bytes potentially leaked at 0x1c3ffa8
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::TypedHandle<coherence::util::logging::Logger>coherence::util::logging::Logger::getLogger() [libcoherence.so]
      coherence::lang::TypedHandle<const coherence::lang::Class>coherence::lang::SystemClassLoader::registerClass(coherence::lang::TypedHandle<const coherence::lang::Class>) [l
      ibcoherence.so]
      __SLIP.INIT_A [libcoherence.so]
      _init          [libcoherence.so]

      PLK: 348 bytes potentially leaked at 0x1dd59d0
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::run::xml::SimpleDocument*coherence::lang::factory<coherence::run::xml::SimpleDocument>::create() [libcoherence.so]
      coherence::lang::TypedHandle<coherence::run::xml::XmlDocument>coherence::run::xml::SimpleParser::parseXml(coherence::lang::String::StringHandle<const coherence::lang::Str
      ing>) [libcoherence.so]
      coherence::lang::TypedHandle<coherence::run::xml::XmlDocument>coherence::run::xml::SimpleParser::parseXml(std::basic_istream<char,std::char_traits<char> >&) [libcoherence
      .so]
      coherence::lang::TypedHandle<coherence::run::xml::XmlElement>coherence::net::CacheFactory::loadXml(std::basic_istream<char,std::char_traits<char> >&) [libcoherence.so]

      PLK: 328 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::util::__unnamed_$sTlKfsrbN0Sy::HashEntrySet*coherence::lang::factory<coherence::util::__unnamed_$sTlKfsrbN0Sy::HashEntrySet>::create<unsigned,float,float>(__ty
      pe_1&,__type_2&,__type_3&) [libcoherence.so]
      coherence::util::Hashtable::Hashtable(unsigned,float,float) [libcoherence.so]
      coherence::util::HashSet::HashSet(unsigned,float,float) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      * Block of 164 bytes (2 times); last block at 0x1e18030

      PLK: 328 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::util::__unnamed_$sTlKfsrbN0Sy::HashEntrySet*coherence::lang::factory<coherence::util::__unnamed_$sTlKfsrbN0Sy::HashEntrySet>::create<unsigned,float,float>(__ty
      pe_1&,__type_2&,__type_3&) [libcoherence.so]
      coherence::util::Hashtable::Hashtable(unsigned,float,float) [libcoherence.so]
      coherence::util::HashSet::HashSet(unsigned,float,float) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      * Block of 164 bytes (2 times); last block at 0x1e1b660

      PLK: 280 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::util::SafeHashMap::Entry*coherence::lang::factory<coherence::util::SafeHashMap::Entry>::create<coherence::lang::TypedHandle<const coherence::lang::Object>,cohe
      rence::lang::TypedHolder<coherence::lang::Object>,unsigned>(__type_1&,__type_2&,_... [libcoherence.so]
      coherence::lang::TypedHandle<coherence::util::SafeHashMap::Entry>coherence::util::SafeHashMap::instantiateEntry(coherence::lang::TypedHandle<const coherence::lang::Object
      ,coherence::lang::TypedHolder<coherence::lang::Object>,unsigned) [libcoherence.so]
      coherence::lang::TypedHolder<coherence::lang::Object>coherence::util::SafeHashMap::put(coherence::lang::TypedHandle<const coherence::lang::Object>,coherence::lang::TypedH
      older<coherence::lang::Object>) [libcoherence.so]
      void coherence::lang::Thread::run() [libcoherence.so]
      * Block of 140 bytes (2 times); last block at 0x1e0e020

      PLK: 256 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::String::StringHandle<coherence::lang::String>coherence::lang::String::create(coherence::lang::SubscriptHandle<const coherence::lang::Array<unsigned char>
      ,const unsigned char,unsigned>,unsigned,unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::util::StringHelper::split(coherence::lang::String::StringHandle... [libcoherence.so]
      coherence::lang::String::StringHandle<const coherence::lang::String>coherence::util::StringHelper::camel(coherence::lang::String::StringHandle<const coherence::lang::Stri
      ng>,coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      coherence::lang::String::StringHandle<const coherence::lang::String>coherence::lang::System::getProperty(coherence::lang::String::StringHandle<const coherence::lang::Stri
      ng>,coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      * Block of 128 bytes (2 times); last block at 0x1e1aae0

      PLK: 256 bytes potentially leaked in 2 blocks
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::String::StringHandle<coherence::lang::String>coherence::lang::String::create(coherence::lang::SubscriptHandle<const coherence::lang::Array<unsigned char>
      ,const unsigned char,unsigned>,unsigned,unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::util::StringHelper::split(coherence::lang::String::StringHandle... [libcoherence.so]
      coherence::lang::String::StringHandle<const coherence::lang::String>coherence::util::StringHelper::camel(coherence::lang::String::StringHandle<const coherence::lang::Stri
      ng>,coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      coherence::lang::String::StringHandle<const coherence::lang::String>coherence::lang::System::getProperty(coherence::lang::String::StringHandle<const coherence::lang::Stri
      ng>,coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      * Block of 128 bytes (2 times); last block at 0x1e11f90


      PLK: 252 bytes potentially leaked at 0x1ddc5f0
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory*coherence::lang::factory<coherence::net::DefaultConfigurableCacheFactory>::create() [libcoherence.so]
      void coherence::net::CacheFactory::configure(coherence::lang::TypedHandle<const coherence::run::xml::XmlElement>,coherence::lang::TypedHandle<const coherence::run::xml::X
      mlElement>) [libcoherence.so]
      int gridConfig::InitConfigXMLFile(std::basic_string<char,std::char_traits<char>,std::allocator<char> >,std::basic_string<char,std::char_traits<char>,std::allocator<char>
      ) [PCFNCoherence.cpp:421]
      int LoadCoherenceConfig() [NETX_Coherence.cpp:163]

      PLK: 228 bytes potentially leaked at 0x1c41d38
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::TypedHandle<coherence::util::Queue>coherence::component::util::QueueProcessor::instantiateQueue()const [libcoherence.so]
      void coherence::component::util::QueueProcessor::onInit() [libcoherence.so]
      coherence::lang::Object*coherence::lang::Object::_attachCaptured(bool) [libcoherence.so]
      coherence::lang::Object*coherence::lang::Object::_attach(bool) [Object.hpp:657]

      PLK: 228 bytes potentially leaked at 0x1cab9b0
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::SubscriptHandle<coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,coherence::lang::MemberHolder<coherence::lang::Object>,un
      signed>coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Obje... [libcoherence.so]
      coherence::lang::SubscriptHandle<const coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,const coherence::lang::MemberHolder<coherence::lang
      ::Object>,unsigned>coherence::util::__unnamed_$sTlK0tsbNEBH::_createMemSuffixArray() [libcoherence.so]
      coherence::lang::SubscriptHandle<const coherence::lang::Array<coherence::lang::MemberHolder<coherence::lang::Object> >,const coherence::lang::MemberHolder<coherence::lang
      ::Object>,unsigned>coherence::util::__unnamed_$sTlK0tsbNEBH::getMemSuffixArray() [libcoherence.so]
      __SLIP.INIT_A [libcoherence.so]

      PLK: 204 bytes potentially leaked at 0x1e21070
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      coherence::lang::ThreadGroup*coherence::lang::factory<coherence::lang::ThreadGroup>::create<coherence::lang::String::StringHandle<coherence::lang::String> >(const __type_
      1&) [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory::DefaultConfigurableCacheFactory(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory*coherence::lang::factory<coherence::net::DefaultConfigurableCacheFactory>::create() [libcoherence.so]

      PLK: 204 bytes potentially leaked at 0x1e17f10
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      coherence::lang::ThreadGroup*coherence::lang::factory<coherence::lang::ThreadGroup>::create<coherence::lang::String::StringHandle<coherence::lang::String> >(const __type_
      1&) [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory::DefaultConfigurableCacheFactory(coherence::lang::String::StringHandle<const coherence::lang::String>) [libcoherence.so]
      coherence::net::DefaultConfigurableCacheFactory*coherence::lang::factory<coherence::net::DefaultConfigurableCacheFactory>::create() [libcoherence.so]

      PLK: 204 bytes potentially leaked at 0x1c7d4e8
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::TypedHandle<const coherence::util::Set>coherence::util::__unnamed_$sTlKSLsbNUbC::getNullSet() [libcoherence.so]
      __SLIP.INIT_A [libcoherence.so]
      void __STATIC_CONSTRUCTOR() [libcoherence.so]
      _init          [libcoherence.so]

      PLK: 204 bytes potentially leaked at 0x1c43d18
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      coherence::lang::ThreadGroup*coherence::lang::factory<coherence::lang::ThreadGroup>::create<char[7]>(const __type_1&) [libcoherence.so]
      coherence::lang::TLSManager::TLSManager() [libcoherence.so]
      void coherence::lang::TLSManager::ensure() [libcoherence.so]


      PLK: 204 bytes potentially leaked at 0x1c43288
      * This memory was allocated from:
      malloc [rtlib.o]
      void*coherence::lang::Allocator::allocate(unsigned) [libcoherence.so]
      coherence::lang::ThreadGroup::ThreadGroup(coherence::lang::String::StringHandle<const coherence::lang::String>,coherence::lang::TypedHandle<coherence::lang::ThreadGroup>)
      [libcoherence.so]
      coherence::lang::ThreadGroup*coherence::lang::factory<coherence::lang::ThreadGroup>::create<char[7]>(const __type_1&) [libcoherence.so]
      coherence::lang::TLSManager::TLSManager() [libcoherence.so]
      void coherence::lang::TLSManager::ensure() [libcoherence.so]

      Edited by: 882600 on Jan 20, 2012 8:08 AM
        • 1. Re: Reg Purify memoery leak with libcoherence.so
          Mfalco-Oracle
          Hi user 88260,

          CacheFactory::configure creates and initializes the default CacheFactory singleton. This is not a leak but a global allocation. You can free this singleton with a call to CacheFactory::shutdown(). Note that even after a call to shutdown purify may still think there is a leak as some shared global data-structures would have been lazily initialized during the configure sequence. If you want to verify that there is no leak I would suggest running an initial configure/shutdown sequence outside of purify and then purify subsequent sequences and you should see that there is no leak from the subsequent sequences as they re-use the shared global data-structures that were lazily initialized during the first sequence. Those shared global structures will be automatically cleaned up when the library is unloaded.

          Mark
          Oracle Coherence
          • 2. Re: Reg Purify memoery leak with libcoherence.so
            Mfalco-Oracle
            I'll also add that many of our operations may appear to leak the first time they are invoked do to heavy use of lazy initialization, so please be sure to test only subsequent invocation for leaks to help avoid lots of false positives.

            Thanks,

            Mark
            Oracle Coherence