Topic
  • 1 reply
  • Latest Post - ‏2013-07-29T14:39:58Z by GarlandJoseph
SystemAdmin
SystemAdmin
549 Posts

Pinned topic malloc core dump when out of heap space

‏2012-12-04T04:52:28Z |
Hi,

While investigating a memory corruption problem in our software, we came across a problem with malloc() causing a segmentation fault when it runs out of heap space. We are using gcc 3.3.2 on AIX 5.3. Has anyone seen this before? Here is a test program:

#include <stdio.h>
#include <stdlib.h>
main()
{
printf("Start malloc test\n");
for(;;)
{
if ( malloc(32*1024) == (void *)0 )
break;
}
printf("Out of memory\n");
}

Thanks,
Carri
  • GarlandJoseph
    GarlandJoseph
    13 Posts

    Re: malloc core dump when out of heap space

    ‏2013-07-29T14:39:58Z  

    You should run dbx on the core so we know where it's blowing up.  You should also insure you are at the latest fixes of AIX.

    do

    dbx <path-to-executable> <path-to-corefile>

    dbx> where

    Then post the results of this.