<?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: calloc() not returning cleared memory in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584371#M679422</link>
    <description>Richard:&lt;BR /&gt;&lt;BR /&gt;Have you tried using the +Orecovery compiler option?  Which is the default...  So maybe +Onorecovery?&lt;BR /&gt;&lt;BR /&gt;After rereading posts I see I'm using an older version of the compiler.  It's disquieting to see heap corruption like this in the latest and greatest HP product.  Unless you have a hardware problem, this could be a big bug somewhere in the toolchain.&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;   -Dave&lt;BR /&gt;</description>
    <pubDate>Thu, 18 Feb 2010 03:16:33 GMT</pubDate>
    <dc:creator>David Johns</dc:creator>
    <dc:date>2010-02-18T03:16:33Z</dc:date>
    <item>
      <title>calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584364#M679415</link>
      <description>&lt;!--!*#--&gt;Good day.  First post on this forum, so apologies in advance if I stray from the ideal approach...&lt;BR /&gt;&lt;BR /&gt;My C application has tripped up on some non-cleared memory obtained via "calloc()".  First, basic backround:&lt;BR /&gt;&lt;BR /&gt;- Developing on HP-UX 11.31 Itanium, 32-bit app.&lt;BR /&gt;&lt;BR /&gt;- Related "swlist" info:&lt;BR /&gt;&lt;BR /&gt;  B9007AA                       C.11.31.04.2   HP C/aC++ Developer's Bundle&lt;BR /&gt;...&lt;BR /&gt;  PHSS_36354                    1.0            assembler patch&lt;BR /&gt;  PHSS_37959                    1.0            LIBCL patch&lt;BR /&gt;  PHSS_38135                    1.0            linker + fdp cumulative patch&lt;BR /&gt;  PHSS_38527                    1.0            Aries cumulative patch&lt;BR /&gt;  PHSS_39100                    1.0            Math Library Cumulative Patch&lt;BR /&gt;  PHSS_39102                    1.0            Integrity Unwind Library&lt;BR /&gt;  PHSS_40544                    1.0            aC++ Runtime (IA: A.06.25, PA: A.03.85)&lt;BR /&gt;  PHSS_40631                    1.0            HP C/aC++ Compiler (A.06.24)&lt;BR /&gt;  PHSS_40633                    1.0            u2comp/be/plugin (C.06.24)&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Frustratingly, I'm not able to reproduce the problem with a slimline, standalone .c build - it seems to have a lot to do with the size/structure of the entire application.  However, I *can* reproduce it with simple test code in main:&lt;BR /&gt;&lt;BR /&gt;TEST #1:&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;   int *test_p;&lt;BR /&gt;&lt;BR /&gt;   test_p = calloc( 6, sizeof(int) );&lt;BR /&gt;&lt;BR /&gt;   if ( test_p )&lt;BR /&gt;   {&lt;BR /&gt;      printf("Allocated address %08.8lX: %X %X %X %X %X %X\n",&lt;BR /&gt;             test_p,&lt;BR /&gt;             test_p[0],&lt;BR /&gt;             test_p[1],&lt;BR /&gt;             test_p[2],&lt;BR /&gt;             test_p[3],&lt;BR /&gt;             test_p[4],&lt;BR /&gt;             test_p[5] );&lt;BR /&gt;&lt;BR /&gt;      free( test_p );&lt;BR /&gt;   }&lt;BR /&gt;   else&lt;BR /&gt;   {&lt;BR /&gt;      printf("Some text.\n" );&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;   return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;&lt;BR /&gt;Allocated address 40165FF0: 0 0 40165FDC 1 0 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The "... 40165FDC 1 ..." shouldn't be there at all.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;As mentioned previously, the problem has a lot to do with overall process structure/sizing.  For example, changing the text size of the second printf (not actually executed) results in different memory contents from "calloc()":&lt;BR /&gt;&lt;BR /&gt;TEST #2: Different text size&lt;BR /&gt;&lt;BR /&gt;int main(int argc, char **argv)&lt;BR /&gt;{&lt;BR /&gt;   int *test_p;&lt;BR /&gt;&lt;BR /&gt;   test_p = calloc( 6, sizeof(int) );&lt;BR /&gt;&lt;BR /&gt;   if ( test_p )&lt;BR /&gt;   {&lt;BR /&gt;      printf("Allocated address %08.8lX: %X %X %X %X %X %X\n",&lt;BR /&gt;             test_p,&lt;BR /&gt;             test_p[0],&lt;BR /&gt;             test_p[1],&lt;BR /&gt;             test_p[2],&lt;BR /&gt;             test_p[3],&lt;BR /&gt;             test_p[4],&lt;BR /&gt;             test_p[5] );&lt;BR /&gt;&lt;BR /&gt;      free( test_p );&lt;BR /&gt;   }&lt;BR /&gt;   else&lt;BR /&gt;   {&lt;BR /&gt;      printf("Some text.1234567890123456\n" );&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;   return 0;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Output:&lt;BR /&gt;&lt;BR /&gt;Allocated address 40166000: 0 0 0 0 0 0&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I've poked at this a number of ways, but no blinding flash of revelation has occurred, I'm afraid...&lt;BR /&gt;&lt;BR /&gt;- I ensured the latest HP compiler patches were applied.&lt;BR /&gt;&lt;BR /&gt;- I used gdb's heap-check options, but calloc() produced "clean" memory under gdb.  The same binary produced "dirty" memory when run outside gdb.&lt;BR /&gt;&lt;BR /&gt;- I compiled/linked with "+check=all" and confirmed from the resulting report that the allocated area was indeed 6x4=24 bytes.&lt;BR /&gt;&lt;BR /&gt;- It seems that adding or removing 16 characters from any text string is enough to "move" the problem.  As a rule, if I can re-jig text or static structures elsewhere in the app to line up the "calloc()" address at or about 0x40165FF0, the returned memory is dirty.&lt;BR /&gt;&lt;BR /&gt;- Our default application makefile uses "-Ae" compiler flag.  I tried messing about with settings like "+u1" and "+Olit=none" to play with alignment and string/constant storage, but - unsurprisingly - the dirty memory issue was still reproducible.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I realise there is a total absence of test code capable of reproducing this outside my environment.  Apologies... I wish there was.  But to be honest, it's hard to reproduce even here - simply editing some text string data is enough to shift the problem sideways.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I've dealt with my fair share of memory corruption strangeness over the years (good old C), but this one seems to lead to an area outside my control.  It looks like memory heap strangeness, but I don't know why I'm experiencing it... and why it hasn't been seen by others.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I'd certainly appreciate any thoughts on this.&lt;BR /&gt;&lt;BR /&gt;Thanks in advance,&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Richard Hooper&lt;BR /&gt;</description>
      <pubDate>Tue, 16 Feb 2010 04:33:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584364#M679415</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-16T04:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584365#M679416</link>
      <description>&amp;gt;some non-cleared memory obtained via calloc().&lt;BR /&gt;&lt;BR /&gt;That's pretty hard to do.  Do you have a threaded application?  What opt level do you use?&lt;BR /&gt;I assume you have included &lt;STDLIB.H&gt; and &lt;STDIO.H&gt;?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I can reproduce it with simple test code in main:&lt;BR /&gt;&lt;BR /&gt;Are you saying that your above example won't fail by itself and you need more of your application "fluff" to get it to fail?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;I'd certainly appreciate any thoughts on this.&lt;BR /&gt;&lt;BR /&gt;Put a hardware watchpoint on the address in question.  You should see it being set to 0.  Then by the bad guy corrupting it.&lt;BR /&gt;(gdb) watch *(int*)(0x40165FF0+2*4)&lt;BR /&gt;(Where the above hex address is what gets returned by calloc.)&lt;/STDIO.H&gt;&lt;/STDLIB.H&gt;</description>
      <pubDate>Tue, 16 Feb 2010 15:46:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584365#M679416</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-16T15:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584366#M679417</link>
      <description>&lt;!--!*#--&gt;Thanks for the assistance.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Do you have a threaded application?&lt;BR /&gt;&amp;gt; What opt level do you use?&lt;BR /&gt;&lt;BR /&gt;No threading, and no specific optimisation flags.  This is 32-bit app, using "-Ae".&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; I assume you have included &lt;STDLIB.H&gt; and &lt;STDIO.H&gt;?&lt;BR /&gt;&lt;BR /&gt;Yes indeed.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;gt; &amp;gt;I can reproduce it with simple test code in main:&lt;BR /&gt;&amp;gt; Are you saying that your above example won't fail by itself and you need more of your application "fluff" to get it to fail?&lt;BR /&gt;&lt;BR /&gt;Correct... even though the fluff isn't executed.&lt;BR /&gt;&lt;BR /&gt;&amp;gt; Put a hardware watchpoint on the address in question. You should see it being set to 0.&lt;BR /&gt;&amp;gt; Then by the bad guy corrupting it.&lt;BR /&gt;&amp;gt; (gdb) watch *(int*)(0x40165FF0+2*4)&lt;BR /&gt;&amp;gt; (Where the above hex address is what gets returned by calloc.)&lt;BR /&gt;&lt;BR /&gt;Done.  Here are the results:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ gdb calloc_test&lt;BR /&gt;HP gdb 5.9 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 5.9 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..&lt;BR /&gt;(gdb) break main&lt;BR /&gt;Breakpoint 1 at 0x401b530:0: file test.c, line 135 from /home/test/bin/calloc_test.&lt;BR /&gt;(gdb) run&lt;BR /&gt;Starting program: /home/test/bin/calloc_test&lt;BR /&gt;&lt;BR /&gt;Breakpoint 1, main () at test.c:135&lt;BR /&gt;135        test_p = calloc( 6, sizeof(int) );&lt;BR /&gt;(gdb) watch *(int*)(0x40165FF0+2*4)&lt;BR /&gt;Cannot evaluate expression, placing a deferred watchpoint.&lt;BR /&gt;Watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 0&lt;BR /&gt;New value = 1075207245&lt;BR /&gt;0x200000007e8c86b0:1 in grow_arena+0x5f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 1075207245&lt;BR /&gt;New value = 1075208157&lt;BR /&gt;0x200000007e8bf350:1 in real_malloc+0x8f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 1075208157&lt;BR /&gt;New value = 1075208156&lt;BR /&gt;0x200000007e8c8d20:2 in grow_arena+0xc62 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Allocated address 40165FF0: 0 0 40165FDC 1 0 0&lt;BR /&gt;&lt;BR /&gt;Program exited normally.&lt;BR /&gt;(gdb) quit&lt;BR /&gt;$&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/STDIO.H&gt;&lt;/STDLIB.H&gt;</description>
      <pubDate>Wed, 17 Feb 2010 01:31:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584366#M679417</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-17T01:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584367#M679418</link>
      <description>&amp;gt;Here are the results:&lt;BR /&gt;&lt;BR /&gt;Sorry, I should have mentioned getting a stack trace (bt) after every change.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;in grow_arena+0x5f1 libc.so.1&lt;BR /&gt;&lt;BR /&gt;A stack trace here and below, will tell us whether it is in calloc or printf that is overwriting the region.</description>
      <pubDate>Wed, 17 Feb 2010 13:39:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584367#M679418</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-17T13:39:02Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584368#M679419</link>
      <description>Hi Richard:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;On HPUX B.11.31 U ia64, cc: HP C/aC++ B3910B A.06.20 [May 13 2008], with the -Ae flag I get:&lt;BR /&gt;&lt;BR /&gt;Allocated address 400123F0: 0 0 0 0 0 0&lt;BR /&gt;&lt;BR /&gt;It doesn't look like a compiler issue.&lt;BR /&gt;&lt;BR /&gt;On my Mac with gcc:&lt;BR /&gt;&lt;BR /&gt;$ gcc -g -Wall -pedantic test_p.c -o test_p&lt;BR /&gt;test_p.c: In function 'main':&lt;BR /&gt;test_p.c:18: warning: '0' flag ignored with precision and '%X' printf format&lt;BR /&gt;test_p.c:18: warning: format '%08.8lX' expects type 'long unsigned int', but argument 2 has type 'int *'&lt;BR /&gt;$ ./test_p&lt;BR /&gt;Allocated address 003000F0: 0 0 0 0 0 0&lt;BR /&gt;&lt;BR /&gt;Do you think the warning has any bearing on the matter?  &lt;BR /&gt;&lt;BR /&gt;Very strange output indeed.&lt;BR /&gt;&lt;BR /&gt;Cheers,&lt;BR /&gt;   -Dave&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 17 Feb 2010 14:51:36 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584368#M679419</guid>
      <dc:creator>David Johns</dc:creator>
      <dc:date>2010-02-17T14:51:36Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584369#M679420</link>
      <description>&amp;gt;David: It doesn't look like a compiler issue.&lt;BR /&gt;&lt;BR /&gt;It isn't obvious, yet.  :-)&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Do you think the warning has any bearing on the matter?&lt;BR /&gt;&lt;BR /&gt;No.  But as you said, the correct format for pointers is %p.</description>
      <pubDate>Wed, 17 Feb 2010 15:05:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584369#M679420</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-17T15:05:05Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584370#M679421</link>
      <description>Test main() duly fixed with regard to %p.&lt;BR /&gt;&lt;BR /&gt;Backtrace performed at every stage.  The output...&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;$ gdb calloc_test&lt;BR /&gt;HP gdb 5.9 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.&lt;BR /&gt;Copyright 1986 - 2001 Free Software Foundation, Inc.&lt;BR /&gt;Hewlett-Packard Wildebeest 5.9 (based on GDB) is covered by the&lt;BR /&gt;GNU General Public License. Type "show copying" to see the conditions to&lt;BR /&gt;change it and/or distribute copies. Type "show warranty" for warranty/support.&lt;BR /&gt;..&lt;BR /&gt;(gdb) break main&lt;BR /&gt;Breakpoint 1 at 0x401b590:0: file test.c, line 136 from /home/test/bin/calloc_test.&lt;BR /&gt;(gdb) run&lt;BR /&gt;Starting program: /home/test/bin/calloc_test&lt;BR /&gt;&lt;BR /&gt;Breakpoint 1, main () at test.c:136&lt;BR /&gt;136        test_p = calloc( 6, sizeof(int) );&lt;BR /&gt;(gdb) watch *(int*)(0x40165FF0+2*4)&lt;BR /&gt;Cannot evaluate expression, placing a deferred watchpoint.&lt;BR /&gt;Watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  main () at test.c:136&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 0&lt;BR /&gt;New value = 1075207245&lt;BR /&gt;0x200000007e8c86b0:1 in grow_arena+0x5f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  0x200000007e8c86b0:1 in grow_arena+0x5f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#1  0x200000007e8bed20:0 in real_malloc+0x2c0 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#2  0x200000007e8bfab0:0 in real_malloc+0x1050 ()&lt;BR /&gt;   from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#3  0x200000007e8be1c0:0 in _malloc+0x140 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#4  0x200000007e77c360:0 in malloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#5  0x200000007e7775c0:0 in calloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#6  0x401b5d0:0 in main () at test.c:136&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 1075207245&lt;BR /&gt;New value = 1075208157&lt;BR /&gt;0x200000007e8bf350:1 in real_malloc+0x8f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  0x200000007e8bf350:1 in real_malloc+0x8f1 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#1  0x200000007e8bfab0:0 in real_malloc+0x1050 ()&lt;BR /&gt;   from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#2  0x200000007e8be1c0:0 in _malloc+0x140 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#3  0x200000007e77c360:0 in malloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#4  0x200000007e7775c0:0 in calloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#5  0x401b5d0:0 in main () at test.c:136&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Hardware watchpoint 2: *(int *) (1075208176 + 2 * 4)&lt;BR /&gt;&lt;BR /&gt;Old value = 1075208157&lt;BR /&gt;New value = 1075208156&lt;BR /&gt;0x200000007e8c8d20:2 in grow_arena+0xc62 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;(gdb) bt&lt;BR /&gt;#0  0x200000007e8c8d20:2 in grow_arena+0xc62 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#1  0x200000007e8bed20:0 in real_malloc+0x2c0 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#2  0x200000007e8bf910:0 in real_malloc+0xeb0 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#3  0x200000007e8be1c0:0 in _malloc+0x140 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#4  0x200000007e77c360:0 in malloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#5  0x200000007e7775c0:0 in calloc+0x160 () from /usr/lib/hpux32/libc.so.1&lt;BR /&gt;#6  0x401b5d0:0 in main () at test.c:136&lt;BR /&gt;(gdb) c&lt;BR /&gt;Continuing.&lt;BR /&gt;Allocated address 40165ff0: 0 0 40165FDC 1 0 0&lt;BR /&gt;&lt;BR /&gt;Program exited normally.&lt;BR /&gt;(gdb)&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 01:42:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584370#M679421</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-18T01:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584371#M679422</link>
      <description>Richard:&lt;BR /&gt;&lt;BR /&gt;Have you tried using the +Orecovery compiler option?  Which is the default...  So maybe +Onorecovery?&lt;BR /&gt;&lt;BR /&gt;After rereading posts I see I'm using an older version of the compiler.  It's disquieting to see heap corruption like this in the latest and greatest HP product.  Unless you have a hardware problem, this could be a big bug somewhere in the toolchain.&lt;BR /&gt;&lt;BR /&gt;Good luck!&lt;BR /&gt;   -Dave&lt;BR /&gt;</description>
      <pubDate>Thu, 18 Feb 2010 03:16:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584371#M679422</guid>
      <dc:creator>David Johns</dc:creator>
      <dc:date>2010-02-18T03:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584372#M679423</link>
      <description>Hi David.&lt;BR /&gt;&lt;BR /&gt;Yes, it's a little unnerving.  I'll poke at that recovery switch when I get the chance.&lt;BR /&gt;&lt;BR /&gt;Personally, I wouldn't be putting any money on seeing this reproduced by other parties... It's hard to reproduce it myself!  I have to add or remove lines of code or static data from my app until the calloc'd area hits the magic address (around 0x40165FF0).&lt;BR /&gt;&lt;BR /&gt;I'm not saying the address in question is a factor, but it's the only reliable guide I have when playing with the issue.  Maybe my app could be at the cusp of crossing some meaningful address/sizing boundary, and that's revealed a bug in the dynamic memory heap management.  Apologies for the diversion into pure conjecture!  :)&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Thu, 18 Feb 2010 03:43:12 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584372#M679423</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-18T03:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584373#M679424</link>
      <description>Are you linking with libpthread?&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Backtrace performed at every stage&lt;BR /&gt;&lt;BR /&gt;They indicate that it never zeroes out the region.&lt;BR /&gt;&lt;BR /&gt;You may have QXCR1000805698 where it tries to optimize and not clear the region because it knows the kernel does this for new pages.  This should be fixed in PHCO_39526.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Maybe my app could be at the cusp of crossing some meaningful address/sizing boundary&lt;BR /&gt;&lt;BR /&gt;Yes, the brk boundary.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;Dave: Have you tried using the +Orecovery compiler option?&lt;BR /&gt;&lt;BR /&gt;Not sure why you think this option may help??&lt;BR /&gt;&lt;BR /&gt;&amp;gt;It's disquieting to see heap corruption&lt;BR /&gt;&lt;BR /&gt;It's a heap optimization gone terribly terribly wrong.  ;-)</description>
      <pubDate>Thu, 18 Feb 2010 09:08:33 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584373#M679424</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2010-02-18T09:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584374#M679425</link>
      <description>Sounds very promising indeed.  This is a demo box from HP - I guess we need to give it some extra TLC!&lt;BR /&gt;&lt;BR /&gt;I'll schedule up any outstanding patches for the weekend, and will re-test on Monday.&lt;BR /&gt;&lt;BR /&gt;Thanks for the detective work - I'll report the results as soon as they are in.&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Fri, 19 Feb 2010 00:25:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584374#M679425</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-19T00:25:18Z</dc:date>
    </item>
    <item>
      <title>Re: calloc() not returning cleared memory</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584375#M679426</link>
      <description>PHCO_39526 nailed it.  A glorious sight...&lt;BR /&gt;&lt;BR /&gt;./calloc_test&lt;BR /&gt;Allocated address 40165ff0: 0 0 0 0 0 0&lt;BR /&gt;&lt;BR /&gt;Thanks very much!&lt;BR /&gt;&lt;BR /&gt;Richard</description>
      <pubDate>Mon, 22 Feb 2010 03:30:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/calloc-not-returning-cleared-memory/m-p/4584375#M679426</guid>
      <dc:creator>R Hooper</dc:creator>
      <dc:date>2010-02-22T03:30:34Z</dc:date>
    </item>
  </channel>
</rss>

