felixcheung commented on a change in pull request #23424:
[SPARK-24421][CORE][FOLLOWUP] Use normal direct ByteBuffer allocation if
Cleaner can't be set
URL: https://github.com/apache/spark/pull/23424#discussion_r244670802
##########
File path: common/unsafe/src/main/java/org/apache/spark/unsafe/Platform.java
##########
@@ -209,21 +209,25 @@ public static long reallocateMemory(long address, long
oldSize, long newSize) {
}
/**
- * Uses internal JDK APIs to allocate a DirectByteBuffer while ignoring the
JVM's
- * MaxDirectMemorySize limit (the default limit is too low and we do not
want to require users
- * to increase it).
+ * Allocate a DirectByteBuffer, potentially bypassing the JVM's
MaxDirectMemorySize limit.
*/
public static ByteBuffer allocateDirectBuffer(int size) {
try {
+ if (CLEANER_CREATE_METHOD == null) {
+ // Can't set a Cleaner (see comments on field), so need to allocate
via normal Java APIs
+ return ByteBuffer.allocateDirect(size);
Review comment:
try /catch OOM and log a message on setting MaxDirectMemorySize?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]