[PATCH] RFR Bug-pending: Enable Hotspot to Track Native Memory Usage for Direct Byte Buffers

Alan Bateman Alan.Bateman at oracle.com
Fri Apr 13 17:26:05 UTC 2018

On 13/04/2018 15:14, Adam Farley8 wrote:
> Hi Alan, Peter,
> I see that native memory is tracked in java.nio.Bits, but that only 
> includes what the user thinks they are allocating.
> When the VM adds extra memory to the allocation amount this extra bit 
> is not represented in the Bits total.
> A cursory glance shows, minimum, that we round the requested memory 
> quantity up to the heap word size in
> the Unsafe.allocateMemory code, and something to do with 
> nmt_header_size in os:malloc() (os.cpp) too.
Is the align_up(sz, HeapWordSize) really causing an issue?

We could change Bits to align with HotSpot. The BufferPoolMXBean API 
allows the capacity and memory usage to differ (when we originally added 
this, direct buffers were page aligned) so doing this would mean it more 
accurately reflects the memory allocated to direct buffers.


More information about the core-libs-dev mailing list