You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by "Scott Cantor (JIRA)" <xe...@xml.apache.org> on 2017/07/27 14:57:00 UTC
[jira] [Closed] (XERCESC-2107) TranscodeFromStr::TranscodeFromStr
definate leak alert
[ https://issues.apache.org/jira/browse/XERCESC-2107?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Scott Cantor closed XERCESC-2107.
---------------------------------
> TranscodeFromStr::TranscodeFromStr definate leak alert
> -------------------------------------------------------
>
> Key: XERCESC-2107
> URL: https://issues.apache.org/jira/browse/XERCESC-2107
> Project: Xerces-C++
> Issue Type: Bug
> Affects Versions: 3.1.1
> Environment: RHEL 3.10
> Reporter: vikas
>
> 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.
> {code}
> 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();
> {code}
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org