Re: [Sablevm-developer] Incrasing SVM_FRAME_NATIVE_REFS_MIN
Brought to you by:
egagnon
From: Etienne G. <gag...@uq...> - 2004-03-04 02:20:19
|
I mean, have a [deep ;-)] look at: http://java.sun.com/docs/books/jni/html/functions.html#70207 Specifically: Global and Local References ... * DeleteLocalRef reclaims the virtual machine resource needed for a local reference. * NewLocalRef is new in Java 2 SDK release 1.2. * EnsureLocalCapacity reserves space in the current thread for a fixed number of local references to be created. EnsureLocalCapacity is new in Java 2 SDK release 1.2. * PushLocalFrame and PopLocalFrame create a nested scope for local references. Both functions are new in Java 2 SDK release 1.2. So, implementing EnsureLocalCapacity would be a nice starting point. SableVM's stack layout has be designed so that Push/PopLocalFrame could be easily implemented too; so this would be a nice second step. Overall, implementing these 3 JNI functions would be better, IMHO, than wasting precious memory resources on every native call to support broken applications. I do NOT think that automatically calling EnsureLocalCapacity when an application goes over 16 local refs is a good idea, either, as it would be hiding the bugs (memory leak). Remember that keeping useless local refs around is very costly in memory, as it prevents the garbage collector from collecting *pointed-to* objects! Etienne -- Etienne M. Gagnon, Ph.D. http://www.info.uqam.ca/~egagnon/ SableVM: http://www.sablevm.org/ SableCC: http://www.sablecc.org/ |