RFR(XS) 8037959: BitMap::resize frees old map before copying memory if !in_resource_area

Coleen Phillimore coleen.phillimore at oracle.com
Fri Mar 21 15:16:29 UTC 2014

Oops, I guess not so good.

On 3/21/14 9:34 AM, Mikael Gerdin wrote:
> Hi Bengt,
> On Friday 21 March 2014 11.59.43 Bengt Rutisson wrote:
>> Hi Mikael,
>> The fix looks good. Since this code path is unused it might be an idea to
>> add a test to exercise it a bit. Is it worth the effort to do that?
> I wrote some tests for resize and they crash with my fix since I now free the
> _map_allocator right after using it :)
> I'll have to withdraw this review request and think about how to refactor the
> resize function without making it even more complex.
> /Mikael
>> Thanks,
>> Bengt
>>> 21 mar 2014 kl. 10:39 skrev Mikael Gerdin <mikael.gerdin at oracle.com>:
>>> Hi all,
>>> While reading through the code for BitMap I stumbled across a bug in the
>>> resize functionality for bitmaps not allocated in the resource area.
>>> The problem is that if a previous backing for the bitmap exists we free
>>> the
>>> backing memory before attempting to copy its contents to the new backing
>>> memory.
>>> I've followed the code paths leading to resize so I'm pretty sure this bug
>>> is currently benign since we never actually encounter this case but it
>>> seems like a good idea to fix this nevertheless.
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8037959
>>> Webrev: http://cr.openjdk.java.net/~mgerdin/8037959/webrev.0
>>> /Mikael

More information about the hotspot-dev mailing list