[tremor] Re: good version of alloca()

Dimitry Andric dim at xs4all.nl
Mon Oct 14 16:10:34 PDT 2002



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2002-10-14 at 18:23:52 timmy brolin wrote:

tb> Can alloca() be replaced by malloc() and free ?
tb> That'd be a nice patch sine many dev systems don't include alloca().

Well, this might not be so simple as it sounds. The reason is that
allocations made using alloca() don't need to be freed explicitly, as
is the case with malloc(). They are implicitly freed when a function
exits and its stack is popped.

Therefore, when you want to replace alloca() with some malloc(), you
will also need to insert lots of free() statements at the correct
locations... :)

It would be nice to be able to use something like GNU alloca, but this
will probably give licensing problems. I'm not sure if there is a BSD
licensed alloca implementation somewhere; maybe someone on this list
knows one?

Cheers,
- --
Dimitry Andric <dim at xs4all.nl>
PGP Key: http://www.xs4all.nl/~dim/dim.asc
Fingerprint: 7AB462D2CE35FC6D42394FCDB05EA30A2E2096A3
Lbh ner abj va ivbyngvba bs gur QZPN

-----BEGIN PGP SIGNATURE-----
Version: 6.5.8ckt http://www.ipgpp.com/
Comment: http://duncan.gn.apc.org/stoa_cover.htm

iQA/AwUBPatA4LBeowouIJajEQJvywCgrGzJqlg/s/e9mpNVPy8Puu2J12oAoODO
Ol3AF4hCOkJrsFl/PEhkm/iM
=DOr/
-----END PGP SIGNATURE-----

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'tremor-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Tremor mailing list