Ngone51 commented on code in PR #47192: URL: https://github.com/apache/spark/pull/47192#discussion_r1679431752
########## core/src/main/java/org/apache/spark/memory/TaskMemoryManager.java: ########## @@ -202,6 +226,18 @@ public long acquireExecutionMemory(long required, MemoryConsumer requestingConsu logger.debug("Task {} acquired {} for {}", taskAttemptId, Utils.bytesToString(got), requestingConsumer); } + + if (mode == MemoryMode.OFF_HEAP) { + synchronized (offHeapMemoryLock) { Review Comment: The whole function `acquireExecutionMemory` is under the protection of `synchronized (this)`, and the release memory can be got from `trySpillAndAcquire()`: ```scala long released = consumerToSpill.spill(requested, requestingConsumer); ``` So I don't think we need extra lock here. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org