> But what I'd really like to know - is there any reason for 
> OS/400 to return NULL after calling for example 
>  r = (char *) malloc(1000000) ;
> 
> I cannot see any reason, why malloc would return NULL, other 
> than expiring address space, which is 2**64 - and I even 
> cannot imagine, how many times I'd have to call 
> abovementioned malloc, before I'll get NULL...

A simple reason is that the [c][m][re]alloc() functions do have limits on the 
iSeries, it's ~ 16MB for all allocations. So, of course, if your program tries 
to allocate more than that over the it's life-cycle, you will get NULL 
returned. Don't be confused by the iSeries' single level storage, it doesn't 
'appear' as such to ILE/C.  To counter this, you can of course use the Terabyte 
storage compiler option to allow larger than 16MB allocations.

Also, realloc() can fail if the pointer to be realloc'ed to points somewhere it 
shouldn't.

--phil


This thread ...

Follow-Ups:

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

This mailing list archive is Copyright 1997-2019 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 here. If you have questions about this, please contact [javascript protected email address].