Why would it be cheaper to use WeakReferences to track disposable objects than 
it would be to use finalizers? Don't both essentially delay garbage-collection 
and don't both only get flagged as disposable at the GC's discretion? At least 
with finalizers you're guaranteed that objects will get GC before 
OutOfMemoryError is thrown, with the WeakReference approach don't you run the 
risk that you'll run out of native resources and throw OutOfMemoryError when 
you don't really have to?

Thanks,
Gili

> But shortly, it uses ReferenceQueue and
>  WeakReferences.
>   It puts a weak reference to the tracked object
>  into a reference queue and when the object is gone
>   the reference is retrieved from the queue,
>  it disposes the resources associated with the
>   object (those resources are kept in a special
>  DisposerRecord object).
[Message sent by forum member 'cowwoc' (cowwoc)]

http://forums.java.net/jive/thread.jspa?messageID=239733

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to