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

2016-01-15 Thread Sergey Bylokhov
Small unrelated note: - It seems that the old code uses Thread class but ManagedLocalsThread should be used instead. The new code looks much simpler/clear. Thanks. On 15/01/16 23:28, Roger Riggs wrote: Hi Laurent, Looks good. Thanks, Roger On 1/15/16 4:28 AM, Laurent Bourgès wrote: Phil

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

2016-01-15 Thread Roger Riggs
Hi Laurent, Looks good. Thanks, Roger On 1/15/16 4:28 AM, Laurent Bourgès wrote: Phil & Roger, Please review the updated webrev according to Roger's comment: http://cr.openjdk.java.net/~lbourges/marlin/marlin-Cleaner.1/ Cha

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

2016-01-15 Thread Laurent Bourgès
Phil & Roger, Please review the updated webrev according to Roger's comment: http://cr.openjdk.java.net/~lbourges/marlin/marlin-Cleaner.1/ Changes: +// Register a cleaning function to ensure freeing off-heap memory:+CleanerFactory.cleaner().register(parent, () -> this.free());

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

2016-01-13 Thread Roger Riggs
Hi Laurent, Nice use. You don't need to use the local_array in this case. Since the reference being cleaned is a the parent object it is ok that the closure captures 'this'. The modules.xml qualified export is fine. Roger On 1/13/16 11:48 AM, Laurent Bourgès wrote: Phil & Roger, Please r

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

2016-01-13 Thread Laurent Bourgès
Phil & Roger, Please review this first webrev refactoring Marlin OffHeapArray to use the new jdk.internal.ref.CleanerFactory (new Cleaner API): http://cr.openjdk.java.net/~lbourges/marlin/marlin-Cleaner.0/ The new API is really great as it just needs few lines: +// Register a cleaning fu

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

2016-01-11 Thread Laurent Bourgès
Phil, I read again the thread RFR 9: JDK-8146028 and it is still in progress ie it is not yet pushed. Few comments below: 2016-01-08 23:16 GMT+01:00 Phil Race : > CleanerFactory's class comment says it is for use "within OpenJDK modules", > so I don't think it is expected we need to create a se

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

2016-01-08 Thread Phil Race
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 inter

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

2016-01-08 Thread Jim Graham
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

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

2016-01-08 Thread Phil Race
CleanerFactory's class comment says it is for use "within OpenJDK modules", so I don't think it is expected we need to create a separate one for each module but I have not read enough of the review threads etc to be sure if there was any caveat to that. Assuming it is OK I think for such new usag

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

2016-01-08 Thread Laurent Bourgès
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