Do compiler threads allocate metaspace?

Thomas Stüfe thomas.stuefe at gmail.com
Tue Nov 13 17:26:41 UTC 2018


Hi all,

can compiler threads allocate Metaspace?

Background:

Clients of us use a "jvmkill" jvmti agent in their cloudfoundry
infrastructure. That agent (see
https://github.com/cloudfoundry/jvmkill) subscribes to the JVMTI
ResourceExhausted Event and then, in the handler, uses JVMTI
FollowReferences() to produce a heap histogram.

What seems to happen is this: We run into a Metaspace OOM, then the
JVMTI agent attempts to print its histogram, walks part of the heap,
then we run into a "guarantee(!thread->is_Compiler_thread())".

Therefore I wonder whether compiler threads can allocate Metaspace?
Looking at the sources, I see potential call paths from the compiler,
e.g. Method::build_interpreter_method_data(), which will allocate
space in Metaspace for a MethodData object, and which in turn, to me,
looks like it could be invoked from compiler code (e.g. during
deoptimization).

If yes - compiler can allocate metaspace - how would they deal with
Metaspace OOMs?

Also note that I am not sure at all whether that type of usage -
calling FollowReferences() when handling ResourceExhausted - is even
allowed in JVMTI.

Thanks a lot,

Best Regards, Thomas


More information about the hotspot-compiler-dev mailing list