malloc() fails: 32MB heap limit and how to work around?

Thomas Hoffmann <[email protected]> Sun, 19 Oct 2003 23:05:14 +0200
Newsgroups gmane.comp.ide.emx.devel
Organization private site
Message-ID <[email protected]>
I ran into problems with an application that malloc()s memory from 
within a DLL.
Now I vaguely remember to have read about problems with using more than 
32MB heap
(a Readme for gcc 3.x said:

I can't allocate more than 32 Mb of memory. What to do?

That's an EMX feature. Usually EMX applications are limited to
using a 32MB heap because the fork() logic expects the heap to be 
allocated in one
big segment. If you don't use fork(), you can use the _uflags() function
to tell the EMX runtime that you don't want your heap to be contiguous.
)

Then I looked into the EMX docs, they say (for _uflags()):

_UF_SBRK_CONTIGUOUS sbrk() always allocates contiguous memory; the size 
of the heap is
limited to the initial heap size.  This is the initial setting; however, 
the malloc() implementation of emx
selects _UF_SBRK_ARBITRARY

Now I am somewhat puzzled: What ARE the restrictions for heap usage and 
HOW can I work around
them?

Thomas.

-- 
Thomas Hoffmann                                   
[email protected]                                  Dresden, Germany