malloc in 64-bit pro*c program Forums - Powered by vBulletin
Results 1 to 2 of 2

Thread: malloc in 64-bit pro*c program

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

    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 :

    #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++) {
    if (p != NULL) {
    c += 4;
    printf("Allocated %3d megabytes successfully\n",c);
    else {
    printf("malloc() failed\n");
    } exit(0);

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

    make -f 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 :

    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 ?



  2. #2
    Join Date
    Jul 2003
    Sofia, Bulgaria
    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