Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
November 22, 2004 alloca and GC | ||||
---|---|---|---|---|
| ||||
Is memory assigned by alloca garbage collected? Because std.process uses alloca, but doesn't use free. ----------------------- Carlos Santander Bernal |
November 22, 2004 Re: alloca and GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 Re: alloca and GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander B. | 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 Re: alloca and GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | 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 Re: alloca and GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dave | "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 Re: alloca and GC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ilya Minkov | 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/ |
Copyright © 1999-2021 by the D Language Foundation