Very poor performance of JNI AttachCurrentThread on Linux

Adam Domurad adomurad at redhat.com
Fri Mar 1 06:48:09 PST 2013


Dmitry Samersoff <dmitry.samersoff at ...> writes:

> 
> Andrew,
> 
> Filed a bug JDK-8009062
> 
> -Dmitry
> 
> On 2013-02-26 21:58, Andrew Haley wrote:
> > get_stack_bounds() was rewritten because of a small memory leak.
> > Instead of simply free()ing the memory to prevent the leak, it was
> > rewritten to use a byte-by-byte loop around read() :
> > 
> >
http://mail.openjdk.java.net/pipermail/hotspot-runtime-dev/2011-February/001864.html
[.. snipped ..]

Hi, Dmitry.

Thanks for filing the bug. I'd like to know if something like this would be
suitable ?

- Have a buffer for reading in the content (whether it be dynamically allocated
once or fixed-size)
- Read in as much as possible with read()
- Scan the buffer contents for '[stack]'
   - If not found, go to the start of the line at the end of our buffer, and
copy this line into the start of our buffer, repeat reading into the buffer
after the point the copy
   - If found, the complete line should be in our buffer, so go to the start of
the line from where we scanned and grab the stack bounds.

This should get a chance to match '[stack]' on every line. 

Let me know if you'd like it in code.

Happy hacking,
-Adam



More information about the hotspot-dev mailing list