Thread overview
alloca and GC
Nov 22, 2004
Dave
Nov 22, 2004
Ilya Minkov
Nov 22, 2004
Ilya Minkov
Nov 23, 2004
Simon Buchan
November 22, 2004
Is memory assigned by alloca garbage collected? Because std.process uses alloca, but doesn't use free.

-----------------------
Carlos Santander Bernal


November 22, 2004
In article <cnrkh1$fo2$1@digitaldaemon.com>, Carlos Santander B. says...
>
>Is memory assigned by alloca garbage collected? Because std.process uses alloca, but doesn't use free.
>
>-----------------------
>Carlos Santander Bernal
>
>

Check this out:

http://www.rt.com/man/alloca.3.html


November 22, 2004
Carlos Santander B. schrieb:

> Is memory assigned by alloca garbage collected? Because std.process uses alloca, but doesn't use free.

Alloca allocates memory using stack pointer increment. This memory is reclaimed when you return from a function and the stack pointer is set back to what it was. Alloca is the fastest way to allocate memory. Another funny thing is, since stack is a GC root, the memory you get using alloca also is - so it is safe to store pointers to GCed memory there as well.

-eye
November 22, 2004
Ilya Minkov schrieb:

> Alloca allocates memory using stack pointer increment. This memory is 

ARGH, decrement, not increment. Because stack grows top-down.

-eye.
November 22, 2004
"Dave" <Dave_member@pathlink.com> escribió en el mensaje
news:cnrq0b$o40$1@digitaldaemon.com...
| In article <cnrkh1$fo2$1@digitaldaemon.com>, Carlos Santander B. says...
| >
| >Is memory assigned by alloca garbage collected? Because std.process uses
alloca,
| >but doesn't use free.
| >
| >-----------------------
| >Carlos Santander Bernal
| >
| >
|
| Check this out:
|
| http://www.rt.com/man/alloca.3.html
|
|

Thanks, Dave and Ilya.

-----------------------
Carlos Santander Bernal


November 23, 2004
On Mon, 22 Nov 2004 17:18:04 +0100, Ilya Minkov <minkov@cs.tum.edu> wrote:

> Ilya Minkov schrieb:
>
>> Alloca allocates memory using stack pointer increment. This memory is
>
> ARGH, decrement, not increment. Because stack grows top-down.
>
> -eye.

Most of the time :D. It is _possible_ to get it to grow up, I believe,
and don't quote me on it, but I suspect other architectures have their
own conventions.

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/