On Mon, 5 Aug 2024 08:42:43 GMT, Johan Sjölen <[email protected]> wrote:
>> 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.
The main purpose of the `if (...)` cases is to find if the request to apply the
delta is valid or not. There are related assertions in VirtualMemory but not so
informative. Also, using `log_debug` lets the build proceed and just show the
messages.
These messages help a lot when something goes wrong in terms of
commit/uncommit/release failure.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/20425#discussion_r1704398731