On Tue, 2006-11-14 at 08:33 -0500, James Carlson wrote:

> If anyone has implemented alloca() via malloc(), I'd expect that's a
> worthless platform to support anyway.  That'd either be a memory leak
> or a hack that dwarfs alloca() by comparison.

There's a version of the latter in the GNU emacs sources; it takes the
address of an automatic variable to see what more can be freed since the
last allocation.

http://cvs.savannah.gnu.org/viewcvs/emacs/src/alloca.c?root=emacs&view=markup

I think I've seen versions which attempt to auto-sense the stack
direction.

A true alloca cannot be implemented without the help of the compiler --
either by the compiler's use of an ABI which permits an
assembly-language stub routine to nondestructively rearrange the
caller's stack frame, or (more sensibly) as a compiler-implemented
primitive.

                                                - Bill


_______________________________________________
opensolaris-code mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to