16MB is the limit for malloc.

From the C Runtime Functions Manual:

13malloc() - Reserve Storage Block Format #include <stdlib.h> void
*malloc(size_t size); Language Level: ANSI Threadsafe: Yes. Description The
malloc() function reserves a block of storage of size bytes. Unlike the
calloc() function, malloc() does not initialize all elements to 0. The
maximum size for a non-Teraspace malloc() is 16711568 byes.
Notes: 1. To use Teraspace storage instead of heap storage without changing
the C source code, specify the TERASPACE(*YES *TSIFC) parameter on the
CRTCMOD compiler command. This maps the malloc() library function to
_C_TS_malloc(), its Teraspace storage counterpart. The maximum amount of
Teraspace storage that can be allocated by each call to _C_TS_malloc() is
2GB - 224, or 2147483424 bytes. If more than 2147483408 bytes are needed on
a single request, call _C_TS_malloc64(unsigned long long int);. For more
information, see the ILE Concepts manual.


-----Original Message-----
From: c400-l-bounces+dchristen=mcleodusa.com@xxxxxxxxxxxx
Behalf Of
Urbanek, Marty
Sent: Thursday, September 06, 2007 12:26 PM
To: c400-l@xxxxxxxxxxxx
Subject: [C400-L] malloc fails

I have a C/400 program trying to do a malloc for approx. 45MB
but malloc
is returning null. No system messages appear in the joblog or on
QSYSOPR. The program works with smaller allocations.

Where is this limit controlled and how can it be increased?


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.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email

NOTICE: This electronic mail transmission may contain confidential
information and is intended only for the person(s) named. Any use, copying
or disclosure by any other person is strictly prohibited. If you have
received this transmission in error, please notify the sender via e-mail.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


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

This mailing list archive is Copyright 1997-2022 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.