RFR: 8294717: (bf) DirectByteBuffer constructor will leak if allocating Deallocator or Cleaner fails with OOME [v2]

Brian Burkhalter bpb at openjdk.org
Thu Oct 6 15:19:28 UTC 2022


On Thu, 6 Oct 2022 08:58:50 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8294717: Add Bits.unreserveMemory to leak prevention
>
> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 148:
> 
>> 146:         } catch (Throwable t) {
>> 147:             // Prevent leak if the Deallocator or Cleaner fail for any reason
>> 148:             UNSAFE.freeMemory(base);
> 
> Bits.unreserveMemory is also needed here.

Oh, right. Fixed in 78e83b4ffd27d4d57a9fa82fd47c197854ac7ac3.

-------------

PR: https://git.openjdk.org/jdk/pull/10588


More information about the nio-dev mailing list