luomh0910 commented on code in PR #13618:
URL: https://github.com/apache/gluten/pull/13618#discussion_r4708155800


##########
gluten-core/src/main/java/org/apache/gluten/memory/memtarget/MemoryTargets.java:
##########
@@ -37,8 +37,15 @@ private MemoryTargets() {
     // enclose factory ctor
   }
 
+  /**
+   * Creates the process-wide memory target that backs {@code 
GlobalOffHeapMemory}, i.e. the
+   * reservations that are not owned by any Spark task (Arrow's global 
allocator, the Velox global
+   * memory listener, ...). Those reservations are backed by real native 
memory, so with dynamic
+   * off-heap sizing on they must be booked in the same shared ledger as the 
task-level targets,
+   * which is what the wrapper below does.
+   */
   public static MemoryTarget global() {
-    return new GlobalOffHeapMemoryTarget();
+    return dynamicOffHeapSizingIfEnabled(new GlobalOffHeapMemoryTarget());

Review Comment:
   Thanks for the detailed repro. dynamic accounting is now selected at borrow 
time, and repayment only unbooks bytes accounted for by the global target 
itself. I also added regression coverage for switching between non-dynamic and 
dynamic SparkContexts in the same JVM.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to