alloca and native code
Tue Sep 12 11:18:00 GMT 2000
Tom Tromey writes:
> >>>>> "Andrew" == Andrew Haley <firstname.lastname@example.org> writes:
> Andrew> It would be nice if we didn't do this in embedded systems,
> Andrew> since it breaks the nice property that Java aprograms have
> Andrew> small stacks, and the stack is only scanned conservatively.
> Andrew> We ought to question if this is a performance win on any
> Andrew> system.
> I usually do it because it is more convenient than doing an explicit
> alloc/free of unscanned memory (eg using _Jv_Malloc).
Yeah, but if you do this you aren't gettting unscanned memory, so this
is rather deceptive.
> In general I only use alloca or a variable array if the size is
> bounded (though that probably isn't always true, sigh). But I
> agree that revisiting this makes sense. Maybe we should enter a
> PR, or even make it part of our "coding standard (if we had one)".
IMO a coding standard would say "in native methods, don't use stack
space for arrays. Howver, short strings are acceptable."
More information about the Java