RFR: 8304074: [JMX] Add an approximation of total bytes allocated on the Java heap by the JVM [v5]
Volker Simonis
simonis at openjdk.org
Tue May 9 14:24:32 UTC 2023
On Tue, 9 May 2023 01:02:32 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> If the `thread` is no longer on any ThreadsList, then it is not safe to access `thread`.
>
> @dcubed-ojdk This is the current thread acting on itself
This method (i.e. `ThreadService::remove_thread()`) is called from `Threads::remove()` *after* the thread was removed from the thread list:
void Threads::remove(JavaThread* p, bool is_daemon) {
...
// Maintain fast thread list
ThreadsSMRSupport::remove_thread(p);
...
ThreadService::remove_thread(p, is_daemon);
But if we reach here from `JavaThread::cleanup_failed_attach_current_thread()` as the comment implies (`JavaThread::cleanup_failed_attach_current_thread()` calls `Threads::remove()` in the case of an attach failure), calling `ThreadService::incr_exited_allocated_bytes()` is probably irrelevant, because a thread which failed to attach can't allocate anyway.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13814#discussion_r1188681748
More information about the hotspot-runtime-dev
mailing list