DBAsupport.com Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: malloc in 64-bit pro*c program

  1. #1
    Join Date
    Sep 2000
    Location
    Sao Paulo,SP,Brazil, Earth, Milky Way
    Posts
    350

    malloc in 64-bit pro*c program

    In a 64-bit OS & hardware (HP-UX 11, v2250 model, 8 Gb of physical RAM present), I want to alloc many Gbs of RAM in a pro*c program. The test program is :

    #include
    #include
    #include
    #include
    #define FOURMEG 4 * 1000 * 1024

    int main()
    {
    int i,c=0;
    void *p;

    printf("Let's eat some memory.\n");
    for (i=0; i<2048; i++) {
    p=malloc(FOURMEG);
    if (p != NULL) {
    c += 4;
    printf("Allocated %3d megabytes successfully\n",c);
    }
    else {
    printf("malloc() failed\n");
    break;
    }
    } exit(0);
    }

    I tried to make this program both in default and in 64-bit memory, using :

    make -f demo_proc.mk build EXE=eat_mem OBJS=eat_mem.o

    only changing build by build64 to make the 64-bit version. Both tries are sucessfull, no errors showed, BUT both versions alloc only up to :

    itxf:/u1/app/oracle/product/8.1.7/precomp/demo/proc>eat_mem
    Let's eat some memory.
    Allocated 4 megabytes successfully
    Allocated 8 megabytes successfully
    Allocated 12 megabytes successfully
    Allocated 16 megabytes successfully
    Allocated 20 megabytes successfully
    Allocated 24 megabytes successfully
    ....
    Allocated 1668 megabytes successfully
    Allocated 1672 megabytes successfully
    Allocated 1676 megabytes successfully
    malloc() failed


    this same prog runs sucessfuly on another 64-bit (aix) machine. Any ideas about what to do next , what to check ?

    Regards,

    Chiappa

  2. #2
    Join Date
    Jul 2003
    Location
    Sofia, Bulgaria
    Posts
    91
    There is a parameter that sets how many segments with n*bytes each your process can allocate in AIX, I can't remember its name, I will ask our unix admin when he come here.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width