surendralilhore commented on code in PR #13045:
URL: https://github.com/apache/gluten/pull/13045#discussion_r4064305886
##########
gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java:
##########
@@ -148,22 +148,24 @@ public long borrow(long size) {
long freeHeapMemory = Runtime.getRuntime().freeMemory();
long usedOffHeapMemory = USED_OFF_HEAP_BYTES.get();
- // Adds the total JVM memory which is the actual memory the JVM occupied
from the operating
- // system into the counter.
- if (exceedsMaxMemoryUsage(totalHeapMemory, usedOffHeapMemory, size, 1.0)) {
+ // Use actual used heap (totalMemory - freeMemory) rather than committed
heap (totalMemory).
+ // Committed heap includes pages the JVM holds but hasn't filled yet;
using it overstates
+ // pressure and causes spurious OOMs between stages when the JVM hasn't
had time to return
+ // committed-but-free pages to the OS.
+ if (exceedsMaxMemoryUsage(totalHeapMemory - freeHeapMemory,
usedOffHeapMemory, size, 1.0)) {
Review Comment:
This is breaking changes done by commit
https://github.com/apache/gluten/pull/9321
The existing code counts committed heap precisely because future Java heap
growth is invisible to the native allocator. If committed heap is high but
mostly free, the intended behavior is to run GC and shrink the JVM commitment
before granting that space to Velox.
--
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]