× 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.



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.





As an Amazon Associate we earn from qualifying purchases.

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-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.