Re: JDK 9 RFR of JDK-8148627: Problem list TestMaxCachedBufferSize.java

2016-02-02 Thread Tony Printezis
;> > I think this test will be tricky to be reliable on 32-bit so the > simplest is to just restrict it to 64-bit with: > > @requires (sun.arch.data.model == "64") > > -Alan. > - Tony Printezis | JVM/GC Engineer / VM Team | Twitter @TonyPrintezis tprinte...@twitter.com

Frequent allocations / promotions of StringCoding$String{Encoder,Decoder} objects

2016-02-25 Thread Tony Printezis
re-use those? (Oh, and also note that this cache does not use SoftReferences, which makes their use by the StringCoding class even more perplexing.) (a tip of the hat to my colleague Peter Beaman for discovering this issue) Tony - Tony Printezis | JVM/GC Engineer / VM Team | Twitter

Re: Frequent allocations / promotions of StringCoding$String{Encoder,Decoder} objects

2016-02-29 Thread Tony Printezis
st way to do this is (move it to a file by itself, make the class public, etc.)? Tony On February 25, 2016 at 4:16:32 PM, Aleksey Shipilev (aleksey.shipi...@oracle.com) wrote: On 02/25/2016 11:48 PM, Tony Printezis wrote: > Has anyone identified this issue before? Hm, there is a blast fr

RFR: 8151098: Introduce multi-slot per-thread cache for StringDecoders/Encoders

2016-03-02 Thread Tony Printezis
(the Charset and the requested charset name). I moved them to a superclass (StringCoder) which made the cache easier to write (I didn’t have to create one subclass for the decoder and one for the encoder, as it is the case in ThreadLocalCoders). Feedback very welcome! Tony - Tony Printezis

Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-05 Thread Tony Printezis
. And it's OK if the hooks can only be used within java.base. FWIW, I did a simple prototype of this (I call the hooks from Thread::exit) and it seems to work as expected. Any thoughts / feedback on this will be very appreciated. Thanks, Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
unreachable, and queue its Cleaner for processing. I’m looking for a hook to explicitly reclaim the direct buffer when Thread::exit is called. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On April 5, 2018 at 6:07:26 PM, David Holmes (david.hol...@oracle.com) wrote: Hi Tony, On

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
Hi David, Thanks for your thoughts. Please see inline. — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On April 5, 2018 at 6:24:11 PM, David Lloyd (david.ll...@redhat.com) wrote: On Thu, Apr 5, 2018 at 4:45 PM, Tony Printezis wrote: > Would proposing to introduce thread e

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
exists on a Thread when I implemented my prototype. Which is why I think introducing an exit hook on ThreadLocal, instead of Thread, is probably the better approach (it will only be called if the ThreadLocal exists). Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On April 6

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
Was there a reason why this was not introduced in the first place? Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On April 6, 2018 at 8:49:17 AM, Peter Levart (peter.lev...@gmail.com) wrote: On 04/06/2018 10:02 AM, Alan Bateman wrote: > On 05/04/2018 22:45, T

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
— Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On April 6, 2018 at 12:16:10 PM, David Lloyd (david.ll...@redhat.com) wrote: On Fri, Apr 6, 2018 at 8:57 AM, Tony Printezis wrote: >> ThreadLocal clearing > > Could you clarify what you mean by ThreadLocal clearing? I

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-04-06 Thread Tony Printezis
Hi Alan, Ah, I hadn’t realized that there’s already some tight coupling between Thread and nio. OK, I’ll just call into sun.nio directly and see what the reviewers say. :-) Is there a CR for this already? Or should I create one? Tony — Tony Printezis | @TonyPrintezis | tprinte

RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-08 Thread Tony Printezis
(jdk.nio.freeBuffersAtThreadExit) and it’s off by default. Should I make it on by default? Or just not add the property all-together? Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-08 Thread Tony Printezis
David, Please see inline. — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 8, 2018 at 11:44:11 AM, David Lloyd (david.ll...@redhat.com) wrote: I'm not a reviewer, but I would ask: how sure are we that it's OK to use lambdas from here? Is there a chance that

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-14 Thread Tony Printezis
free to decide on which approach is most appropriate! :-) I’ll be happy with any of the proposals. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 11, 2018 at 10:13:30 AM, Alan Bateman (alan.bate...@oracle.com) wrote: On 08/05/2018 16:07, Tony Printezis wrote: > Hi

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-14 Thread Tony Printezis
arily iterating over all the map entries (which was my main concern with Alan’s original webrev). I’ll be totally happy with a version of this. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 12, 2018 at 6:44:08 AM, Peter Levart (peter.lev...@gmail.com) wrote: Hi,

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-17 Thread Tony Printezis
easily add that functionality if needed (I can use WeakReferences for that). However, for the uses we’re considering, is it really necessary? Thoughts? Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 14, 2018 at 12:40:28 PM, Tony Printezis (tprinte...@twitter.com

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-18 Thread Tony Printezis
also keeps the code a bit less verbose. I can use JdkThreadLocal directly. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 17, 2018 at 4:39:20 PM, Peter Levart (peter.lev...@gmail.com) wrote: Hi Tony, If we anticipate only small number of JdkThreadLocal(s) (there wi

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-18 Thread Tony Printezis
Local objects in the array directly. Regards, Peter On 05/17/18 20:25, Tony Printezis wrote: Hi all, I have a new version of the code for your consideration: http://cr.openjdk.java.net/~tonyp/8202788/webrev.1/ I basically combined our two approaches. The usage is as Alan had proposed it: Users h

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-05-30 Thread Tony Printezis
Hi all, Any more thoughts on this? (with apologies for the ping) Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 18, 2018 at 3:58:57 PM, Tony Printezis (tprinte...@twitter.com) wrote: Hi again, Stylistically, I strongly prefer this version over the previous one

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-05 Thread Tony Printezis
Hey Alan, Any thoughts on this? (with apologies for the ping) Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On May 30, 2018 at 5:16:44 PM, Peter Levart (peter.lev...@gmail.com) wrote: I thought there would be some hint from Alan about which of the two paths we should

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-06 Thread Tony Printezis
please! :-) This will be very helpful and can avoid completely unnecessary allocations. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 6, 2018 at 9:38:05 AM, Alan Bateman (alan.bate...@oracle.com) wrote: On 30/05/2018 22:16, Peter Levart wrote: > I thought th

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-06 Thread Tony Printezis
); return super.get(); } One more question re: getIfPresent() (and maybe I’m overthinking this): It returns null to indicate that a value is not present. Isn’t null a valid ThreadLocal value? Would using an Optional here be more appropriate? Tony — Tony Printezis | @TonyPrintezis | tprinte

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-06 Thread Tony Printezis
Hi Peter, Thanks for the updated webrev! Please see inline. — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 6, 2018 at 2:55:51 PM, Peter Levart (peter.lev...@gmail.com) wrote: Ok, here's next webrev: http://cr.openjdk.java.net/~plevart/jdk-dev/DBBCache_Cl

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-07 Thread Tony Printezis
Peter, Inline. — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 7, 2018 at 5:21:43 AM, Peter Levart (peter.lev...@gmail.com) wrote: Hi Tony, Thanks for taking a look. Just a couple of comments inline... On 06/06/18 22:38, Tony Printezis wrote: - instead of

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-18 Thread Tony Printezis
essentially the same issue? Apart from that, I personally like this proposal as I agree: one look-up is always better than two. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 18, 2018 at 10:13:02 AM, Martin Buchholz (marti...@google.com) wrote: I'm ignorin

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-19 Thread Tony Printezis
Good idea, as long as it re-uses the existing ThreadLocal infrastructure and doesn’t introduce an extra per-thread map. Making it a ThreadLocal subclass would be an excellent start. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 19, 2018 at 9:07:07 AM, David Lloyd

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-20 Thread Tony Printezis
that, after all the threads have exited, the total native count / size is 0). Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 20, 2018 at 10:08:48 AM, Peter Levart (peter.lev...@gmail.com) wrote: On 06/18/2018 05:41 PM, Alan Bateman wrote: > > > On 17/06/2

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-21 Thread Tony Printezis
Peter, Attached TerminatingThreadLocalTest.java. Let me know what you think (and feel free to modify it / discard it if you don’t like it!). Re: The test for the max cached buffer size is: test/jdk/sun/nio/ch/TestMaxCachedBufferSize.java. I looked at it and, unfortunately, — Tony Printezis

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-21 Thread Tony Printezis
always be 0. Let me look into this and I’ll get back to you in a bit. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 21, 2018 at 12:14:24 PM, Tony Printezis (tprinte...@twitter.com) wrote: Peter, Attached TerminatingThreadLocalTest.java. Let me know what you think

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-21 Thread Tony Printezis
…and I also hadn’t attached the test. Sorry, I’m clearly very distracted today! — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 21, 2018 at 12:17:57 PM, Tony Printezis (tprinte...@twitter.com) wrote: (I unfortunately pressed Send accidentally; apologies) I was saying

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-21 Thread Tony Printezis
I’m trying exactly that. :-) — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 21, 2018 at 12:59:58 PM, Peter Levart (peter.lev...@gmail.com) wrote: On 06/21/2018 06:17 PM, Tony Printezis wrote: I was saying: I looked at TestMaxCachedBufferSize and, unfortunately, I

Re: RFR: JDK-8202788: Explicitly reclaim cached thread-local direct buffers at thread exit

2018-06-21 Thread Tony Printezis
Peter, The changes to TestMaxCachedBufferSize.java look fine. One point though: Why do you need the TmpDirectBuffersReclamation.java test? In TestMaxCachedBufferSize.java you just call checkDirectBuffers(0, 0); after you the main thread calls join() on the workers? Tony — Tony Printezis

Re: Promptly freeing the per-thread cached direct buffers when a thread exits

2018-06-22 Thread Tony Printezis
is consistent (IMHO) with this behavior. Tony — Tony Printezis | @TonyPrintezis | tprinte...@twitter.com On June 22, 2018 at 7:11:05 AM, Alan Bateman (alan.bate...@oracle.com) wrote: On 21/06/2018 21:13, Florian Weimer wrote: > * Tony Printezis: > >> There are a few obvious ways