RFR: 8333658: NMT: Use an allocator with 4-byte pointers to save memory in NativeCallStackStorage
Johan Sjölen
jsjolen at openjdk.org
Thu Jun 6 15:25:48 UTC 2024
On Thu, 6 Jun 2024 14:10:58 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/nmt/indexedFreeListAllocator.hpp line 67:
>>
>>> 65: be_freed.link = free_start;
>>> 66: free_start = i;
>>> 67: }
>>
>> I don't think a free(index) is very useful. We need a free(E* e), that calculates I from &e. (Your one real world usage example, NativeCallStackStorage, conveniently never frees :=)
>
> And we may want a function, complementing `at()`, that gives us the index for a given element pointer.
I did start a port of the Treap to this allocator interface and there was no particular problem with using `free(I)` instead of `free(E* e)`. I gave up on that because it was a much larger change and I didn't know what the response would be to the interface itself (plus, we really do want to give back memory). Performing an inversion might not be easy. Consider something like a chunk allocator like our arena, translating index (`uint16_t chunk; uint16_t index;`) to a pointer requires walking the chunks.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18979#discussion_r1629742386
More information about the hotspot-dev
mailing list