RFR: 8151436: Leaner ArrayAllocator and BitMaps
stefan.karlsson at oracle.com
Wed Mar 9 15:58:43 UTC 2016
On 2016-03-09 16:56, Thomas Schatzl wrote:
> On Wed, 2016-03-09 at 15:28 +0100, Stefan Karlsson wrote:
>> Hi all,
>> I found a bug in the ArrayAllocator code. ArrayAllocator::free
>> incorrectly calls should_use_malloc(size_for_malloc(length)) when the
>> call should be should_use_malloc(length).
>> There is an -XX:+ExecuteInternalVMTests that exercises this code
>> and try to find these kinds of bugs. The test actually manages to
>> allocate_malloc and then tries to free the memory with free_mmap, but
>> the JVM doesn't crash. One reason why it doesn't crash is that
>> os::release_memory, which is used by free_mmap, fails to unmap the
>> malloced memory and we silently ignores that.
>> This patch:
>> 1) Adds an assert to ensure that the os::release_memory call
>> This immediately shows the problem when we execute our internal vm
>> 2) Moves the implementation of should_use_malloc to the inline file,
>> that it can reuse size_for_malloc.
>> 3) Fix the bug.
> looks good.
More information about the hotspot-dev