Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Invalid
-
3.1.1
-
None
-
None
-
None
-
RHEL 3.10
Description
Memory analyzer tool (valgrind) showing memory leak at TranscodeFromStr.
No exception raised when constructing TranscodeFromStr object.
Below is snip from valgrind
==8884== 20,770 bytes in 1 blocks are possibly lost in loss record 2,123 of 2,137
==8884== at 0x4C2A243: operator new(unsigned long) (vg_replace_malloc.c:334)
==8884== by 0xA374512: xercesc_3_1::MemoryManagerImpl::allocate(unsigned long) (in /usr/openv/lib/libvxxml4c.so.6)
==8884== by 0xA2E4DFD: xercesc_3_1::TranscodeFromStr::transcode(unsigned char const*, unsigned long, xercesc_3_1::XMLTranscoder*) (in /usr/openv/lib/libvxxml4c.so.6)
==8884== by 0xA2E50BC: xercesc_3_1::TranscodeFromStr::TranscodeFromStr(unsigned char const*, unsigned long, char const*, xercesc_3_1::MemoryManager*) (in /usr/openv/lib/libvxxml4c.so.6)
I called XMLPlatformUtils::Initialize() at the time of loading and XMLPlatformUtils::Terminate() when exiting.
XMLPlatformUtils::Initialize(); { std::string sample = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\" ?> <testxml> <IDList> <ID dentifier=\"demo1\" Name=\"demo1\"> </ID> <ID dentifier=\"demo2\" Name=\"demo2\"> </ID> </IDList> </testxml>"; XMLCh * xmlStr = xercesc::XMLString::transcode (sample.c_str()) TranscodeToStr transcodeTo(xmlStr, "UTF-8"); const XMLByte* bytes = transcodeTo.adopt(); xercesc::XMLString::release(&xmlStr); TranscodeFromStr transcodeFrom(bytes, transcodeTo.length(),"UTF-8"); XMLCh * xmlch_ptr = transcodeFrom.adopt(); char * c_ptr = xercesc::XMLString::transcode(xmlch_ptr); std::string encodedstr(c_ptr); xercesc::XMLString::release(&c_ptr); } XMLPlatformUtils::Terminate();