RFR: 8337217: Port VirtualMemoryTracker to use VMATree

Johan Sjölen jsjolen at openjdk.org
Fri Nov 8 10:52:07 UTC 2024


On Mon, 5 Aug 2024 08:41:49 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> In `MemoryFileTracker`, the changes in commit/reserve are applied to a local `VirtualMemorySnapshot`. Here we have to apply them to the global `VirtualMemorySummary`.
>
> Yeah, that doesn't seem like a problem.
> 
> ```c++
>   for (int i = 0; i < mt_number_of_types; i++) {
>     r = diff.flag[i].reserve;
>     c = diff.flag[i].commit;
>     flag = NMTUtil::index_to_flag(i);
>     VirtualMemory* mem = VirtualMemorySummary::as_snapshot()->by_type(flag);
>     reserved = mem->reserved();
>     committed = mem->committed();
>     mem->reserve_memory(r);
>     mem->commit_memory(c);
>     if ((size_t)-r > reserved) {
>       print_err("release");
>     }
>     if ((size_t)-c > reserved || (size_t)c > committed) {
>       print_err("uncommit");
>     }
>   }

This applies the reserve/commit regardless of outcome, so slightly different.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20425#discussion_r1703753128


More information about the core-libs-dev mailing list