Uploaded image for project: 'Xerces-C++'
  1. Xerces-C++
  2. XERCESC-1901

memory address leak when running many threads which will parsing xml files

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 3.0.1
    • None
    • SAX/SAX2
    • None
    • Red Hat Enterprise Linux Server release 5.1 (Tikanga)
      -g++ --version : x86_64-redhat-linux-g++ (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)

    Description

      when running 5 threads , in each thread a xml file will (for test purpost xerces-c-3.0.1\samples\data\long.xml is used)
      be parsed, it is found, by top command , VIRT increase large , by pmap command , 3 (some time 4) memory address block about 64 m
      are found , when by 8 threads , there will be 5 (some time 6) such blocks :
      Address Kbytes Mode Offset Device Mapping
      00002aaab00b9000 64796 ----- 00002aaab00b9000 000:00000 [ anon ]
      ...
      00002aaab40b9000 64796 ----- 00002aaab40b9000 000:00000 [ anon ]
      ...
      00002aaab80bb000 64788 ----- 00002aaab80bb000 000:00000 [ anon ]

      these blocks will not be released even after XMLPlatformUtils::Terminate();
      if there is only one thead , there is no such a problem

      chief code structure:
      main(){
      XMLPlatformUtils::Initialize();
      //start many threads
      //wait for alll threads ends
      XMLPlatformUtils::Terminate();
      }
      in each thread :
      while(true){
      ...

      auto_ptr<SAXParser> parser( new SAXParser() );
      parser->setDocumentHandler(this); //the handler do nothing but just extend from HandlerBase
      parser->setErrorHandler(this); //the handler do nothing but just extend from HandlerBase
      parser->setValidationScheme(SAXParser::Val_Never);
      parser->setDoSchema(false);
      parser->setDoNamespaces(true);
      parser->parse(inputFile.c_str());

      }
      refer to attachment for detail about the simple test code

      one more related question :

      in the doc , it is said "client application needs to Terminate() (or multiple Terminate() in the case where multiple Initialize() have been invoked before" , does it also suit for more than one threads ?

      for example :
      thread 1 : XMLPlatformUtils::Initialize(); //A
      thread 1 : do some parsing //B
      thread 2 : XMLPlatformUtils::Initialize(); //C
      thread 2 : do some parsing //D
      thread 1 : do some parsing //E
      thread 1 : XMLPlatformUtils::Terminate(); //F
      thread 2 : do some parsing //G
      thread 1 : XMLPlatformUtils::Terminate(); //H
      }
      since these two api are all static , then does C will affect E and does F affect G

      Attachments

        1. mainNew
          4 kB
          tao xiaochuan
        2. test.zip
          2 kB
          tao xiaochuan

        Activity

          People

            Unassigned Unassigned
            txc tao xiaochuan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: