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



Thanks, Elvis and Duane.

I was just reading the same page of that manual. I have turned on the
teraspace option and now the malloc succeeds.

-Marty

-----Original Message-----
From: c400-l-bounces+marty_urbanek=stercomm.com@xxxxxxxxxxxx
[mailto:c400-l-bounces+marty_urbanek=stercomm.com@xxxxxxxxxxxx] On
Behalf Of Christen, Duane J.
Sent: Thursday, September 06, 2007 1:33 PM
To: 'C programming iSeries / AS400'
Subject: Re: [C400-L] malloc fails

16MB is the limit for malloc.

From the C Runtime Functions Manual:
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/books/sc4156
07.p
df



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.


Duane

-----Original Message-----
From: c400-l-bounces+dchristen=mcleodusa.com@xxxxxxxxxxxx
[mailto:c400-l-bounces+dchristen=mcleodusa.com@xxxxxxxxxxxx]On
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?

Thanks,
-Marty

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



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