Very poor performance of JNI AttachCurrentThread on Linux

Dmitry Samersoff dmitry.samersoff at oracle.com
Fri Mar 1 08:00:43 PST 2013


Adam,

Thank you for advice! I'm looking for a possibility to remove
get_stack_bounds function entirely as Dean suggested. But it takes some
time.

-Dmitry

On 2013-03-01 18:48, Adam Domurad wrote:
> 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
> 


-- 
Dmitry Samersoff
Oracle Java development team, Saint Petersburg, Russia
* Give Rabbit time, and he'll always get the answer


More information about the hotspot-dev mailing list