RFR: 8280289: Enhance debug pp() command with NMT info [v3]

Ioi Lam iklam at openjdk.java.net
Sat Jan 22 19:58:04 UTC 2022


On Sat, 22 Jan 2022 14:56:30 GMT, Zhengyu Gu <zgu at openjdk.org> wrote:

>> src/hotspot/share/services/virtualMemoryTracker.cpp line 693:
>> 
>>> 691: };
>>> 692: 
>>> 693: const ReservedMemoryRegion* VirtualMemoryTracker::find_region(void* p) {
>> 
>> Curious, is this thread-safe? Do we care if not?
>
> It is not thread-safe. But the command is running inside debuger, I don't see there is concurrent case.

Not sure about gdb, but I tried running a simple multi threaded program inside lldb on the mac. When calling a function, lldb will resume the program so other threads will execute concurrently.

In this case, `walk_virtual_memory` is protected by a `ThreadCritical`. However, the value returned by `find_region` may become invalid as soon as `walk_virtual_memory` returns because it could be deallocated by another thread.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7160


More information about the hotspot-dev mailing list