reading thread name

Volker Simonis volker.simonis at gmail.com
Fri Jul 11 03:55:06 PDT 2008


Hi Nagy,

you can try to put a ResourceMark in the block where you use
"thread->name()" like so:

...
ResourceMark rm;
// ignore non-named threads
if (strcmp(thread->name(), "Unknown Thread") == 0)
   return;
...

A resource mark releases all resources allocated after it was
constructed when the destructor is called and thread->name() somwhere
calls UNICODE::as_utf8 which allocates memory in the thread-local
resource area.

Regards,
Volker

On 7/11/08, Nagy1981 <nagy.mostafa at gmail.com> wrote:
>
>  Hi,
>  I am modifying the CPP Interpreter such that the InterpreterRuntime function
>  below gets invoked on each Java bytecode method call:
>
>  IRT_ENTRY(void, InterpreterRuntime::CCT_update(JavaThread *thread, int
>  type))
>
>         static methodOop current = NULL;        // calling method
>
>         static int bci = -1;                 // call-site
>
>
>         // ignore non-java threads
>         if (!thread->is_Java_thread())
>                 return;
>
>         // ignore non-named threads
>         if (strcmp(thread->name(), "Unknown Thread") == 0)
>                 return;
>  ...
>
>  The funtion should return, if the name of the thread is "Unknown Thread".
>  This works fine for a simple HelloWorld program, but when I try one of
>  DaCapo benchmarks the execution fails with the following error:
>
>  #
>  # A fatal error has been detected by the Java Runtime Environment:
>  #
>  # java.lang.OutOfMemoryError: requested 32756 bytes for ChunkPool::allocate.
>  Out of swap space?
>  #
>  #  Internal Error (allocation.cpp:117), pid=27659, tid=3084180368
>  #  Error: ChunkPool::allocate
>  #
>  # Java VM: OpenJDK Server VM (13.0-b02 interpreted mode linux-x86 )
>  # An error report file with more information is saved as:
>  # /home/nagy/research/hotspot/test/hs_err_pid27659.log
>  #
>  # If you would like to submit a bug report, please visit:
>  #   http://java.sun.com/webapps/bugreport/crash.jsp
>  #
>  Aborted
>
>  After trying to debug the code, I found that the problem is with the call to
>  thread->name(). When I remove it, the execution terminates successfully. It
>  seems that successive calls to thread->name() induces some sort of memory
>  leakage. Is this a bug in hotspot or is there something I am missing here ?
>
>  thanks,
>  - nagy
>
>
>
>
>  --
>  View this message in context: http://www.nabble.com/reading-thread-name-tp18394454p18394454.html
>  Sent from the OpenJDK Hotspot Compiler Development List mailing list archive at Nabble.com.
>
>



More information about the hotspot-compiler-dev mailing list