alloca and native code
Jeff Sturm
jeff.sturm@appnet.com
Tue Sep 12 06:58:00 GMT 2000
Oskar Liljeblad wrote:
> Is it ok to use alloca from native code?
I think so. There may be some portability issues; i.e. some OSes need alloca.h,
some don't have it:
#ifdef HAVE_ALLOCA_H
#include <alloca.h>
#endif
> I want to allocate a piece
> of memory which isn't scanned or collected by the GC, which is freed
> when the (native implementation of the) method returns.
Memory reserved with alloca() _will_ be scanned by boehm-gc, like the rest of
the stack. To avoid that, you could allocate memory with _Jv_AllocBytes
instead. I don't remember if that function is exported, however.
--
Jeff Sturm
jeff.sturm@appnet.com
More information about the Java
mailing list