This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: About malloc() ....


Alexandre D'Alton wrote:
> 
> I would like to know what are the requirements for the malloc()
> function.
> 
> I have created a thread who calls the malloc() function, after 3 calls
> with a size of 0x1000h, it returns NULL. The stack size allocated to
> this thread is 4000000 !!!
> 
> Can somebody explain me this strange behaviour ?

The malloc implementation in the current releases is a bit dumb. You have
to configure the size of the malloc pool in the configuration - look in
your configuration under libc for "Size of the dynamic memory pool in
bytes" (aka CYGNUM_LIBC_MALLOC_MEMPOOL_SIZE).

Out of interest, I don't know any systems where increasing the thread stack
size increases the memory pool available to malloc().

For what it's worth, I've already fixed all this up so that malloc() can
use all available memory on all systems for its heap, and also ported
dlmalloc as an additional implementation, but I haven't had a chance to
make it public yet. Soon....

> Ho, my architecture is MPC860 with 32meg of sdram and i am using ecos
> v1.2.1 because I have not enought time to begin the 1.3.1 port to my
> board.

That's a shame.

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]