RFR(S): 8248910: NPE when freeing the memory for a slice from a buffer

Yangfei (Felix) felix.yang at huawei.com
Wed Jul 8 03:34:47 UTC 2020


Hi,

    Bug: https://bugs.openjdk.java.net/browse/JDK-8248910 
    Webrev: http://cr.openjdk.java.net/~fyang/8248910/webrev.00/ 

    The overall procedure is described by the newly add test.
    For a slice from a ByteBuffer, it does not have a cleaner, which leads to the NPE.
    Here, I thinks we should not try to free the memory of a slice.
    Proposed fix adds a null check for cleaner in Util.free before invoking its clean() method.
    Another possible way would be catching slice in Util. releaseTemporaryDirectBuffer and exclude it.
    
    Tier1-3 tested on x86_64-linux-gnu.  Newly add test fail without the fix and pass otherwise.
    Comments?

Thanks,
Felix


More information about the core-libs-dev mailing list