RFR (S): 8239070: Memory leak when unsuccessfully mapping in archive regions

Ioi Lam ioi.lam at oracle.com
Fri Feb 14 16:08:45 UTC 2020


Hi Thomas,

Thanks for fixing this issue. Freeing the array at each exit point seems 
error prone. How about: refactoring the function to a 
FileMapInfo::map_heap_data_impl function, allocate inside 
FileMapInfo::map_heap_data(), call map_heap_data() and if it returns 
false, free the array in a single place.

Thanks
- Ioi

On 2/14/20 7:09 AM, Thomas Schatzl wrote:
> Hi all,
>
>   can I have reviews for this change that plugs a (tiny) memory leak 
> when we unsuccessfully map CDS archives into the Java heap?
>
> The FileMapInfo::map_heap_data() method allocates some array of 
> MemRegions, and in case we fail to map the archive, we return that 
> method without assigning it to something or deallocating that memory.
>
> Found while working on JDK-8238999, also out for review, and depending 
> on it.
>
> CR:
> https://bugs.openjdk.java.net/browse/JDK-8239070
> Webrev:
> http://cr.openjdk.java.net/~tschatzl/8239070/webrev/
> Testing:
> hs-tier1-4
>
> Thanks,
>   Thomas



More information about the hotspot-gc-dev mailing list