<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Purify reports std::vector memory leak in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190783#M91307</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've encountered problems with std::vector on HPUX. Purify reports memory leaks:&lt;BR /&gt;MLK: 1536 bytes leaked in 2 blocks&lt;BR /&gt;This memory was allocated from:&lt;BR /&gt;malloc [rtlib.o]&lt;BR /&gt;operator new(unsigned long) [libCsup_v2.2]&lt;BR /&gt;operator new(unsigned long) [rtlib.o]&lt;BR /&gt;std::vector&lt;STOPPERT&gt;&amp;gt;::_C_insert_aux(stoppert *,const stoppert &amp;amp;) [vector.cc:157]&lt;BR /&gt;std::vector&lt;STOPPERT&gt;&amp;gt;::push_back(const stoppert &amp;amp;) [vector:566]&lt;BR /&gt;Stopper::start() [Stopper.cpp:72]&lt;BR /&gt;static Connection::ClntMsgTh(void *) [Connection.cpp:8864]&lt;BR /&gt;__pthread_body [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]&lt;BR /&gt;__pthread_start [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]&lt;BR /&gt;Block of 768 bytes (2 times); last block at 0x80000001006b7e68&lt;BR /&gt;&lt;BR /&gt;here is Stopper::start() function:&lt;BR /&gt;int Stopper::start()&lt;BR /&gt;{&lt;BR /&gt;stoppert start;&lt;BR /&gt;ftime( &amp;amp;start.time );&lt;BR /&gt;start.index = nextIndex++;&lt;BR /&gt;times.push_back(start);&lt;BR /&gt;&lt;BR /&gt;return start.index;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;times is a std:vector member of Stopper class.&lt;BR /&gt;&lt;BR /&gt;Method start() is called from Connection::ClntMsgTh on a local variable:&lt;BR /&gt;Stopper mtx_time;&lt;BR /&gt;mtx_time.start();&lt;BR /&gt;&lt;BR /&gt;Beside this one, purify reports leaks in many other calls of Stopper::start().&lt;BR /&gt;&lt;BR /&gt;I'm using aCC: HP ANSI C++ B3910B A.03.70&lt;BR /&gt;&lt;BR /&gt;Can anyone help me explaining this leaks?&lt;/STOPPERT&gt;&lt;/STOPPERT&gt;</description>
    <pubDate>Fri, 02 May 2008 07:29:37 GMT</pubDate>
    <dc:creator>putagunta</dc:creator>
    <dc:date>2008-05-02T07:29:37Z</dc:date>
    <item>
      <title>Purify reports std::vector memory leak</title>
      <link>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190783#M91307</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I've encountered problems with std::vector on HPUX. Purify reports memory leaks:&lt;BR /&gt;MLK: 1536 bytes leaked in 2 blocks&lt;BR /&gt;This memory was allocated from:&lt;BR /&gt;malloc [rtlib.o]&lt;BR /&gt;operator new(unsigned long) [libCsup_v2.2]&lt;BR /&gt;operator new(unsigned long) [rtlib.o]&lt;BR /&gt;std::vector&lt;STOPPERT&gt;&amp;gt;::_C_insert_aux(stoppert *,const stoppert &amp;amp;) [vector.cc:157]&lt;BR /&gt;std::vector&lt;STOPPERT&gt;&amp;gt;::push_back(const stoppert &amp;amp;) [vector:566]&lt;BR /&gt;Stopper::start() [Stopper.cpp:72]&lt;BR /&gt;static Connection::ClntMsgTh(void *) [Connection.cpp:8864]&lt;BR /&gt;__pthread_body [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]&lt;BR /&gt;__pthread_start [libpthread.1_pure_p3_c0_101232010_B1111_64_178192.a2s.HPUX.24291.tmp]&lt;BR /&gt;Block of 768 bytes (2 times); last block at 0x80000001006b7e68&lt;BR /&gt;&lt;BR /&gt;here is Stopper::start() function:&lt;BR /&gt;int Stopper::start()&lt;BR /&gt;{&lt;BR /&gt;stoppert start;&lt;BR /&gt;ftime( &amp;amp;start.time );&lt;BR /&gt;start.index = nextIndex++;&lt;BR /&gt;times.push_back(start);&lt;BR /&gt;&lt;BR /&gt;return start.index;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;times is a std:vector member of Stopper class.&lt;BR /&gt;&lt;BR /&gt;Method start() is called from Connection::ClntMsgTh on a local variable:&lt;BR /&gt;Stopper mtx_time;&lt;BR /&gt;mtx_time.start();&lt;BR /&gt;&lt;BR /&gt;Beside this one, purify reports leaks in many other calls of Stopper::start().&lt;BR /&gt;&lt;BR /&gt;I'm using aCC: HP ANSI C++ B3910B A.03.70&lt;BR /&gt;&lt;BR /&gt;Can anyone help me explaining this leaks?&lt;/STOPPERT&gt;&lt;/STOPPERT&gt;</description>
      <pubDate>Fri, 02 May 2008 07:29:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190783#M91307</guid>
      <dc:creator>putagunta</dc:creator>
      <dc:date>2008-05-02T07:29:37Z</dc:date>
    </item>
    <item>
      <title>Re: Purify reports std::vector memory leak</title>
      <link>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190784#M91308</link>
      <description>&amp;gt;I'm using aCC: HP ANSI C++ B3910B A.03.70&lt;BR /&gt;&lt;BR /&gt;I don't remember when I fixed the last bug in vector.  For 11.11, you can patch up to A.03.77, PHSS_36087:&lt;BR /&gt;&lt;A href="http://h21007.www2.hp.com/portal/site/dspp/template.PAGE/page.document/?ciid=2645dec4c7563110VgnVCM100000275d6e10RCRD#b11.11pa" target="_blank"&gt;http://h21007.www2.hp.com/portal/site/dspp/template.PAGE/page.document/?ciid=2645dec4c7563110VgnVCM100000275d6e10RCRD#b11.11pa&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Can anyone help me explaining this leaks?&lt;BR /&gt;&lt;BR /&gt;From your source, when you call push_back, you have to make a copy of "start" to add it to the vector.  (If you are very unlucky, and the vector is full, every element must be copied but that shouldn't have leaks.)&lt;BR /&gt;&lt;BR /&gt;Do you know the size of a stoppert?  Is it 1536/2?  If not, that size could be due to the vector reallocation.  What's on vector.cc:157?&lt;BR /&gt;&lt;BR /&gt;Where are you destroying Stopper::times?</description>
      <pubDate>Fri, 02 May 2008 08:45:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190784#M91308</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-02T08:45:56Z</dc:date>
    </item>
    <item>
      <title>Re: Purify reports std::vector memory leak</title>
      <link>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190785#M91309</link>
      <description>&amp;gt;you can patch up to A.03.77, PHSS_36087: &lt;BR /&gt;I will try this, but it will take some time, because I am not the system administrator...&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Where are you destroying Stopper::times?&lt;BR /&gt;Stopper::times should be destroyed when the Stopper object exits the scop, i.e. when Connection::ClntMsgTh returns. I don't know if this is important, but this function is called every time from a different thread. &lt;BR /&gt;&lt;BR /&gt;&amp;gt; Do you know the size of a stoppert?&lt;BR /&gt;Size of stoppert is 24.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;What's on vector.cc:157?&lt;BR /&gt;I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:&lt;BR /&gt;_C_end_of_storage = __start + __new_capacity;&lt;BR /&gt;I think I'm looking in the wrong file.</description>
      <pubDate>Fri, 02 May 2008 14:41:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190785#M91309</guid>
      <dc:creator>putagunta</dc:creator>
      <dc:date>2008-05-02T14:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Purify reports std::vector memory leak</title>
      <link>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190786#M91310</link>
      <description>&amp;gt;I will try this, but it will take some time, because I am not the system administrator.&lt;BR /&gt;&lt;BR /&gt;All you need is the two vector include files.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Stopper::times should be destroyed when the Stopper object exits the scope&lt;BR /&gt;&lt;BR /&gt;I assume it leaks after there?  If before, it's a different issue.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Size of stoppert is 24.&lt;BR /&gt;&lt;BR /&gt;Then it looks like the whole vector is messed up?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I would love to know this. In /opt/aCC/include_std/vector.cc:157 I found:&lt;BR /&gt;_C_end_of_storage = __start + __new_capacity;&lt;BR /&gt;I think I'm looking in the wrong file.&lt;BR /&gt;&lt;BR /&gt;The last 3 versions have this same line but there could be 2 fixes missing.&lt;BR /&gt;&lt;BR /&gt;JAGaf50801: vector&lt;BOOL&gt;::insert doesn't set last. Problem is with caller to copy_backward, not itself.&lt;BR /&gt;JAGad78735: can't change _C_end_of_storage if not reallocated.&lt;BR /&gt;JAGad87227: Fix for allocation of uninitialized storage&lt;/BOOL&gt;</description>
      <pubDate>Fri, 02 May 2008 23:49:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/purify-reports-std-vector-memory-leak/m-p/4190786#M91310</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2008-05-02T23:49:07Z</dc:date>
    </item>
  </channel>
</rss>

