JDK-8257039: Memory allocated by GenericTaskQueue::_array_allocator may be double freed

Hohensee, Paul hohensee at amazon.com
Wed Apr 14 21:16:17 UTC 2021


If I read this correctly, you're disabling ArrayAllocator::free() to accommodate ~GenericTaskQueue, which latter explicitly frees the queue element array. This seems backwards to me because ~GenericTaskQueue currently reachs into the implementation of ArrayAllocator, violating encapsulation. Your original patch, which eliminated the explicit free in ~GenericTaskQueue, removed that reaching and left it up to ~ArrayAllocator to handle it, which is what I'd prefer.

Thanks,
Paul

-----Original Message-----
From: jdk8u-dev <jdk8u-dev-retn at openjdk.java.net> on behalf of "wattsun(孙宇)" <wattsun at tencent.com>
Date: Wednesday, December 23, 2020 at 2:06 AM
To: "jdk8u-dev at openjdk.java.net" <jdk8u-dev at openjdk.java.net>
Subject: JDK-8257039: Memory allocated by GenericTaskQueue::_array_allocator may be double freed

Dear All,

     may I hava this small bug fix to review?

     Bug: https://bugs.openjdk.java.net/browse/JDK-8257039





the diff:



diff -r 83661fdee9f0 src/share/vm/utilities/taskqueue.hpp

--- a/src/share/vm/utilities/taskqueue.hpp      Wed Nov 18 06:55:35 2020 +0000

+++ b/src/share/vm/utilities/taskqueue.hpp      Wed Nov 25 18:10:28 2020 +0800

@@ -314,7 +314,7 @@

 };



 template<class E, MEMFLAGS F, unsigned int N>

-GenericTaskQueue<E, F, N>::GenericTaskQueue() {

+GenericTaskQueue<E, F, N>::GenericTaskQueue() : _array_allocator(false) {

   assert(sizeof(Age) == sizeof(size_t), "Depends on this.");

 }





Thanks!

watt




More information about the jdk8u-dev mailing list