Hi,

I have installed the following JDK on my machine:

java version "1.6.0"
Java(TM) SE Runtime Environment (build pxi3260sr12-20121025_01(SR12))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux x86-32
jvmxi3260sr12-20121024_126067 (JIT enabled, AOT enabled)
J9VM - 20121024_126067
JIT  - r9_20120914_26057
GC   - 20120928_AA)
JCL  - 20121014_01

When I try to run the following test from the IBM developerworks wrt
WeakReferences and ReferenceQueue, the reference is never put on the
reference queue (the problem that I also had in the WeakHashtable testcase):

url: http://www.ibm.com/developerworks/library/j-refs/

output:

Example of incorrectly holding a strong reference
object is MyObject@3b203b2
The weak reference is java.lang.ref.WeakReference@46d046d
Polling the reference queue returns null
Getting the referent from the weak reference returns MyObject@3b203b2
Calling GC
Polling the reference queue returns null
Getting the referent from the weak reference returns null

Example of correctly releasing a strong reference
object is MyObject@2bd62bd6
The weak reference is java.lang.ref.WeakReference@37c637c6
Polling the reference queue returns null
Getting the referent from the weak reference returns MyObject@2bd62bd6
Set the obj reference to null and call GC
Polling the reference queue returns null
Getting the referent from the weak reference returns null
In finalize method for this object: MyObject@3b203b2
In finalize method for this object: MyObject@2bd62bd6


Polling the reference queue always returns null, even when the
WeakReference has lost its referent.

Can somebody confirm this?

Thanks,

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to