[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: java_io_File.c deletelocalref and cl in ObjectInputStream

From: Etienne Gagnon
Subject: Re: java_io_File.c deletelocalref and cl in ObjectInputStream
Date: Fri, 28 Nov 2003 00:47:41 -0500
User-agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.5) Gecko/20031110 Debian/1.5-3

David Bélanger wrote:
I think Etienne did these two changes, I'm not sure.  Maybe Etienne
could answer your questions on these.

java_io_File.c: Basically, it frees a local ref, I guess otherwise it may
run out of local refs for a long directory listing.

       (*env)->SetObjectArrayElement(env, filearray, i, str);
+      (*env)->DeleteLocalRef (env, str);

Yes.  This was a bug in Classpath.  One needs to free native locals, as they
consume memory.  A virtual machine only garantees the availability of 16 local
refs, by default (JNI Spec).  To get more, one must do the appropriate JNI
calls. I don't understand ClassLoader enough to explain this

-      return cl.loadClass (osc.getName ());
+      return Class.forName (osc.getName (), false, cl);

The idea is that "initialization" should NOT be triggered.  cl.loadClass will
initialize the class; this is why we should use Class.forName.

Etienne M. Gagnon, Ph.D.   

reply via email to

[Prev in Thread] Current Thread [Next in Thread]