<?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 Re: cobol memory leak when using threads in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050291#M94291</link>
    <description>&amp;gt;I think it makes no difference in the code.&lt;BR /&gt;&lt;BR /&gt;I thought it would stop the whole process.  That's what it did in COBOLII/iX.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;If i do not kill the thread, it finishes by it self, there is no memory leak.&lt;BR /&gt;&lt;BR /&gt;Have you created the thread in the right state?  If you use don't use detach, you may have to use pthread_join to recover the space??  PTHREAD_CREATE_JOINABLE is the default&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Could you please tell me how can I debug this proces with gdb? I thought that debugger was for C only.&lt;BR /&gt;&lt;BR /&gt;You are imagining you have a COBOL program.  You debug in assembly mode.  ;-)&lt;BR /&gt;&lt;BR /&gt;You just use:&lt;BR /&gt;gdb executable&lt;BR /&gt;(gdb) set heap-check on&lt;BR /&gt;(gdb) r parms to your program ...&lt;BR /&gt;&lt;BR /&gt;And the end:&lt;BR /&gt;(gdb) info leaks&lt;BR /&gt;&lt;BR /&gt;You can download gdb from:&lt;BR /&gt;&lt;A href="http://www.hp.com/go/wdb" target="_blank"&gt;http://www.hp.com/go/wdb&lt;/A&gt;</description>
    <pubDate>Tue, 07 Aug 2007 06:51:53 GMT</pubDate>
    <dc:creator>Dennis Handly</dc:creator>
    <dc:date>2007-08-07T06:51:53Z</dc:date>
    <item>
      <title>cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050287#M94287</link>
      <description>&lt;BR /&gt;Hi gurus:&lt;BR /&gt;&lt;BR /&gt;I am trying to find where is the error in this code. I just want to create a thread and from the main program, kill it.&lt;BR /&gt;I do dat in a loop and the mémory grows and grows. I can se than the tread is beeng killed but i don´t know why the memory is growing.&lt;BR /&gt;&lt;BR /&gt;Could you pleas help me ?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance:&lt;BR /&gt;&lt;BR /&gt;The code :&lt;BR /&gt;&lt;BR /&gt;       $set sourceformat"free"&lt;BR /&gt;       $set REENTRANT"1"&lt;BR /&gt;&lt;BR /&gt;IDENTIFICATION DIVISION.&lt;BR /&gt;PROGRAM-ID. prueba_signal.&lt;BR /&gt;AUTHOR. Ignacio Javier Sanchez.&lt;BR /&gt;DATE-WRITTEN. 06-06-2007.&lt;BR /&gt;&lt;BR /&gt;DATA DIVISION.&lt;BR /&gt;WORKING-STORAGE SECTION.&lt;BR /&gt;&lt;BR /&gt;01 flag                         pic s9(9) comp-5.&lt;BR /&gt;01 id-hilo-unix         pic s9(9) comp-5 value 0.&lt;BR /&gt;01 unix-self   pic s9(9) comp-5 value 0.&lt;BR /&gt;&lt;BR /&gt;01 thread-id-p-mixto                    usage pointer.&lt;BR /&gt;&lt;BR /&gt;LINKAGE SECTION.&lt;BR /&gt;PROCEDURE DIVISION.&lt;BR /&gt;&lt;BR /&gt;perform until 1=2&lt;BR /&gt;&lt;BR /&gt;call 'CBL_THREAD_CREATE' using 'HILO-PRUEBA'&lt;BR /&gt;              0&lt;BR /&gt;     by value 0&lt;BR /&gt;              0 &lt;BR /&gt;       0 &lt;BR /&gt;       0&lt;BR /&gt;by reference thread-id-p-mixto&lt;BR /&gt;&lt;BR /&gt;call "usleep" using by value 500000&lt;BR /&gt;display "hilo nuevo creado.........................."&lt;BR /&gt;perform mata-hilo&lt;BR /&gt;&lt;BR /&gt;end-perform&lt;BR /&gt;stop run.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;mata-hilo.&lt;BR /&gt;display "Vamos a hacer un kill sobre el hilo"&lt;BR /&gt;call 'CBL_THREAD_KILL' using by value thread-id-p-mixto&lt;BR /&gt;.&lt;BR /&gt;fin-mata-hilo.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;entry "HILO-PRUEBA".&lt;BR /&gt;display "soy el hilo hijo"&lt;BR /&gt;call "sleep" using by value 300&lt;BR /&gt;stop run&lt;BR /&gt;.</description>
      <pubDate>Mon, 06 Aug 2007 08:54:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050287#M94287</guid>
      <dc:creator>Ignacio Javier</dc:creator>
      <dc:date>2007-08-06T08:54:37Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050288#M94288</link>
      <description>Shalom,&lt;BR /&gt;&lt;BR /&gt;It may not be your code.&lt;BR /&gt;&lt;BR /&gt;It may be a problem with the cobol compiler.&lt;BR /&gt;&lt;BR /&gt;It could also be a system problem. Has the system been patched with a recent bi-annual patch set?&lt;BR /&gt;&lt;BR /&gt;SEP</description>
      <pubDate>Mon, 06 Aug 2007 08:59:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050288#M94288</guid>
      <dc:creator>Steven E. Protter</dc:creator>
      <dc:date>2007-08-06T08:59:16Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050289#M94289</link>
      <description>Not knowing anything about COBOL since the 1985 Standard, why do you have "stop run" at the end of your "HILO-PRUEBA"?&lt;BR /&gt;&lt;BR /&gt;Is there a way to get the status of your CBL_THREAD_KILL?&lt;BR /&gt;&lt;BR /&gt;If the solution still isn't obvious, you'll have to debug at the C level and use gdb's leak detection and perhaps use tusc.</description>
      <pubDate>Tue, 07 Aug 2007 05:17:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050289#M94289</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-07T05:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050290#M94290</link>
      <description>&lt;BR /&gt;Thanks:&lt;BR /&gt;&lt;BR /&gt;The result of the call 'CBL_THREAD_KILL' is a success. I can see than the thread is not present and so the System shows it.&lt;BR /&gt;But the memory grows.....&lt;BR /&gt;&lt;BR /&gt;The stop run is there because i was doing tests. I think it makes no difference in the code.&lt;BR /&gt; &lt;BR /&gt;If i do not kill de thread, it finishes by it self, there is no memory leak.&lt;BR /&gt;I have made a work around using a signal that the thread captures and then executes a stop run.&lt;BR /&gt;&lt;BR /&gt;Could you please tell me how can I debug this proces with gdb ? I thought that debugger was for C only.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 07 Aug 2007 06:22:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050290#M94290</guid>
      <dc:creator>Ignacio Javier</dc:creator>
      <dc:date>2007-08-07T06:22:10Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050291#M94291</link>
      <description>&amp;gt;I think it makes no difference in the code.&lt;BR /&gt;&lt;BR /&gt;I thought it would stop the whole process.  That's what it did in COBOLII/iX.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;If i do not kill the thread, it finishes by it self, there is no memory leak.&lt;BR /&gt;&lt;BR /&gt;Have you created the thread in the right state?  If you use don't use detach, you may have to use pthread_join to recover the space??  PTHREAD_CREATE_JOINABLE is the default&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Could you please tell me how can I debug this proces with gdb? I thought that debugger was for C only.&lt;BR /&gt;&lt;BR /&gt;You are imagining you have a COBOL program.  You debug in assembly mode.  ;-)&lt;BR /&gt;&lt;BR /&gt;You just use:&lt;BR /&gt;gdb executable&lt;BR /&gt;(gdb) set heap-check on&lt;BR /&gt;(gdb) r parms to your program ...&lt;BR /&gt;&lt;BR /&gt;And the end:&lt;BR /&gt;(gdb) info leaks&lt;BR /&gt;&lt;BR /&gt;You can download gdb from:&lt;BR /&gt;&lt;A href="http://www.hp.com/go/wdb" target="_blank"&gt;http://www.hp.com/go/wdb&lt;/A&gt;</description>
      <pubDate>Tue, 07 Aug 2007 06:51:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050291#M94291</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-07T06:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050292#M94292</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;As I recall, a "STOP RUN" in a COBOL program means immediate termination of everything.  There is no cleanup (epilog) code executed.&lt;BR /&gt;&lt;BR /&gt;From that standpoint, I think I would expect any thread or process that had malloc()ed memory to be killed without an opportunity to free() that memory.&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 07 Aug 2007 08:34:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050292#M94292</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2007-08-07T08:34:51Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050293#M94293</link>
      <description>&amp;gt;JRF: I think I would expect any thread or process that had malloc()ed memory to be killed without an opportunity to free() that memory.&lt;BR /&gt;&lt;BR /&gt;Except if you terminate the process, the OS frees everything.</description>
      <pubDate>Tue, 07 Aug 2007 17:51:43 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050293#M94293</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2007-08-07T17:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: cobol memory leak when using threads</title>
      <link>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050294#M94294</link>
      <description>&lt;BR /&gt;Hi:&lt;BR /&gt;&lt;BR /&gt;The code is never reaching the point the "stop run." is.&lt;BR /&gt;The thread it is waiting 300 seconds and the main process, kills it before it gets to that point.&lt;BR /&gt;&lt;BR /&gt;I i do the following:&lt;BR /&gt;&lt;BR /&gt;entry "HILO-PRUEBA".&lt;BR /&gt;display "soy el hilo hijo"&lt;BR /&gt;stop run&lt;BR /&gt;.&lt;BR /&gt;&lt;BR /&gt;What finishes is the thread and not the hole process. And all the resources ( what it was worth when the thread was created ) are free.&lt;BR /&gt;&lt;BR /&gt;So, the problem begins when you want to finish a thread with the 'CBL_THREAD_KILL' call.&lt;BR /&gt;&lt;BR /&gt;Regards&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 08 Aug 2007 02:21:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/cobol-memory-leak-when-using-threads/m-p/4050294#M94294</guid>
      <dc:creator>Ignacio Javier</dc:creator>
      <dc:date>2007-08-08T02:21:16Z</dc:date>
    </item>
  </channel>
</rss>

