[OpenJDK 2D-Dev] Cleaner usage in java2 / awt

Phil Race philip.race at oracle.com
Fri Jan 8 23:44:57 UTC 2016


The internal one may be better than the public one as it has lower 
over-head.
I saw an email from Roger replying to someone who questioned why he used
the internal one and his reason was he was seeing OOME with the public 
one ..
And that is enough reason to proceed carefully even with the internal one.

-phil.

On 01/08/2016 03:38 PM, Jim Graham wrote:
> We should probably be looking to replace Java2D's Disposer with the 
> new Cleaner.  The reason that we didn't use the prior non-public 
> Cleaner was that it didn't support all reference types and we were 
> using (I think) Phantom references?  I think the new public Cleaner is 
> more configurable so we should look into it again.
>
> In the meantime, if the new Cleaner mechanism meets your needs then 
> please do use it...
>
>             ...jim
>
> On 1/8/16 1:00 PM, Laurent Bourgès wrote:
>> Phil,
>>
>> I started changing the Marlin OffHeapArray class to use the new jdk
>> internal Cleaner instead of my own solution (ReferenceQueue +
>> PhantomReference + Thread). Or should I use the java2d Disposer 
>> instead ?
>>
>> It seems working well and many lines are removed.
>>
>> Do you plan adding a shared Cleaner instance (Thread) for java2d as the
>> java.base module will have ?
>>
>> Probably it is also applicable to the sun.java2d.Disposer ?
>>
>> It would reduce the number of running threads to dispose / free 
>> resources !
>>
>> Regards,
>> Laurent
>>




More information about the 2d-dev mailing list