The largest single allocation is about 16MB. The size of default heap is about 4GB per activation group. Alexei Pytel always speaking for myself "Hall, Philip" <phall@xxxxxxxx> Sent by: c400-l-bounces@xxxxxxxxxxxx 08/29/2003 08:37 AM Please respond to C programming iSeries / AS400 To: "C programming iSeries / AS400" <c400-l@xxxxxxxxxxxx> cc: Subject: RE: [C400-L] Testing malloc results for null on the 400 (was:HTTPAuthentication / base64 encoder?) > 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 is the C programming iSeries / AS400 (C400-L) mailing list To post a message email: C400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/c400-l or email: C400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/c400-l.