RFR: 8146523: Incorrect memory tracker used by os::unmap_memory()

David Holmes david.holmes at oracle.com
Wed Jan 6 06:33:21 UTC 2016

Hi Jiangli,

On 6/01/2016 8:30 AM, Jiangli Zhou wrote:
> Hi,
> Please review the small fix for JDK-8146523 <https://bugs.openjdk.java.net/browse/JDK-8146523>:
>    http://cr.openjdk.java.net/~jiangli/8146523/webrev.00/
> The os::map_memory() and os:unmapp_memory() functions use the memory tracker asymmetrically. The os::map_memory() function calls MemTracker::record_virtual_memory_reserve_and_commit() to track the mapped memory, while os::unmap_memory() uses the 'virtual_memory_release_tracker' to track the memory being unmapped. In NMT, there are different types of tracker for releasing and uncommitting memory. The ‘virtual_memory_uncommit_tracker' is for 'uncommit’ and ‘virtual_memory_release_tracker’ is for 'release'. The os::unmap_memory() should use the ‘virtual_memory_uncommit_tracker' to be balanced with os::map_memory().

I find this very confusing. Is there some document that describes the 
relationship between mapping, reserving and committing virtual memory 
and the related NMT functionality? It is not at all clear to me why 
reserve_and_commit pairs with uncommit (unless committed memory must 
first be reserved, and uncommit both uncommits and "unreserves" ??)


> Tested with test/runtime/NMT.
> Thanks,
> Jiangli

More information about the hotspot-runtime-dev mailing list