× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



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>

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

for(i=1;;i++)
{
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");
}
break;
}
free (string);
}
return (0);
}



James Rich



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 by midrange.com 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.