This is an automated email from the ASF dual-hosted git repository.
zhouyuan pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gluten.git
The following commit(s) were added to refs/heads/main by this push:
new 0209ec8e16 [CORE] Log error when -Xms equals -Xmx makes JVM heap
shrinking ineffective (#12480)
0209ec8e16 is described below
commit 0209ec8e16bcbdb9f6ac8d1ae87faf434b351b20
Author: xumanbu <[email protected]>
AuthorDate: Wed Jul 15 14:27:33 2026 +0800
[CORE] Log error when -Xms equals -Xmx makes JVM heap shrinking ineffective
(#12480)
Add a check in DynamicOffHeapSizingMemoryTarget static initializer to
detect when -Xms equals or is very close to -Xmx. In this scenario, the JVM
heap size is fixed and System.gc() cannot shrink totalMemory (return committed
pages to OS), making the shrinkOnHeapMemory mechanism ineffective. An error log
is emitted to alert users, consistent with the existing checks for
-XX:+ExplicitGCInvokesConcurrent and -XX:+DisableExplicitGC.
Co-authored-by: jam.xu <[email protected]>
---
.../memory/memtarget/DynamicOffHeapSizingMemoryTarget.java | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git
a/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java
b/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java
index 5898ae45e2..ed5be45e8b 100644
---
a/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java
+++
b/gluten-core/src/main/java/org/apache/gluten/memory/memtarget/DynamicOffHeapSizingMemoryTarget.java
@@ -105,6 +105,18 @@ public class DynamicOffHeapSizingMemoryTarget implements
MemoryTarget, KnownName
ORIGINAL_MIN_HEAP_FREE_RATIO = originalMinHeapFreeRatio;
ORIGINAL_MAX_HEAP_FREE_RATIO = originalMaxHeapFreeRatio;
+ long maxMem = Runtime.getRuntime().maxMemory();
+ long initTotalMem = Runtime.getRuntime().totalMemory();
+ if (initTotalMem >= maxMem * 0.95) {
+ LOG.error(
+ "JVM heap appears fixed or nearly fixed (totalMemory={},
maxMemory={}). "
+ + "This typically means -Xms is equal or close to -Xmx. "
+ + "Explicit JVM shrinking will not be effective because the JVM "
+ + "cannot return committed heap to the OS.",
+ initTotalMem,
+ maxMem);
+ }
+
if (!isJava9OrLater()) {
// For JDK 8, we cannot change MaxHeapFreeRatio programmatically at
runtime.
LOG.error("Dynamic off-heap sizing is not supported before JDK 9.");
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]