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


On Wed, Jul 19, 2000 at 05:46:01PM +0100, Jonathan Larmour wrote:

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

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

Out of further interest, many systems (not eCos, AFAIK) have
alloca() which allocates space on the stack frame.  

However, the lifetime of the space is that of the stack frame.
You can't use the space after the function that called alloca()
returns. If you need a temporary buffer for something it's
fine.  If you're building a global, persistent linked list of
objects, it's not.

-- 
Grant Edwards
grante@visi.com

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