Jon Paris wrote:
  >> Below is the code and it had no problems allocating 16,000,000 bytes to
each of 50 pointers.  Am I missing or misunderstanding something?

No Mel - but I must be.  And if Bruce says it is closer to 4G I would never
doubt his word.  I am obviously confusing User Spaces with heap size.  Even
so your results appear to fly in the face of some other test results that
were reported on Midrange(?) a while back.

I wrote the following little program to test. On linux if ends with:

james@stumpy:~/progs> ./bigmalloc
malloc() failed, size: 1000000000, errno: 12
Not enough memory

On V4R1 it ends with:

malloc() failed, size: 100000000, errno: 0

linux box has 256M of RAM, twice that for swap. V4R1 has 128M RAM. Interestingly on iSeries errno is not set to ENOMEM. Don't know why.

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <errno.h>

main ()
  char *string;
  int i;
  unsigned long power;

power = pow (10, i);
string = (char *) malloc (sizeof (char) * power);
if (string == NULL)
printf ("malloc() failed, size: %d, errno: %d\n", sizeof (char) * power, errno);
if (errno == ENOMEM)
printf ("Not enough memory\n");
free (string);
return (0);

James Rich

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].