RFR: 8312132: Add tracking of multiple address spaces in NMT [v95]

Thomas Stuefe stuefe at openjdk.org
Thu May 23 16:14:15 UTC 2024


On Thu, 23 May 2024 15:05:51 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:

>> test/hotspot/gtest/nmt/test_nmt_treap.cpp line 81:
>> 
>>> 79:     }
>>> 80:   }
>>> 81: 
>> 
>> All nodes are same-sized, no? So we don't have to track individual allocations. We can just count them. In the end, counter must be 0.
>
> I don't get how the size matters, but I just added a counter. Fixed!

Ugh, my comment was in the wrong place. It refers to LeakCheckedAllocator. You track every allocation via an own structure `Check`. I don't know why you do this. The only reason I can see is if you were to check that a to-be-free'd pointer exists, but exists only once, in the array. I don't see that.

Therefore, if you don't plan to check that (and I don't think that is needed), you can just count: +1 on alloc, -1 on free. That works since all allocations have the same size (which you could check, btw, on allocate). Then, make sure that upon release, count is 0.

No need for the Check structure array. 0.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18289#discussion_r1611968887


More information about the hotspot-dev mailing list