This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: About malloc() ....
- To: Grant Edwards <grante at visi dot com>
- Subject: Re: [ECOS] About malloc() ....
- From: Gary Thomas <gthomas at redhat dot com>
- Date: Wed, 19 Jul 2000 11:03:51 -0600 (MDT)
- Cc: ecos-discuss at sourceware dot cygnus dot com
On 19-Jul-2000 Grant Edwards wrote:
> 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.
>
alloca() is supported by most ports of GCC internally. In some
cases, you need to access it via __builtin_alloca(), but it's there.