You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/08/03 12:55:24 UTC

(commons-compress) 02/02: Adjust memory test

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit 2c35a133dd89a5e5512fc90918004d0b13842ec6
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 3 08:55:16 2025 -0400

    Adjust memory test
---
 src/main/java/org/apache/commons/compress/MemoryLimitException.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/compress/MemoryLimitException.java b/src/main/java/org/apache/commons/compress/MemoryLimitException.java
index c0941f603..a77c3b8a4 100644
--- a/src/main/java/org/apache/commons/compress/MemoryLimitException.java
+++ b/src/main/java/org/apache/commons/compress/MemoryLimitException.java
@@ -59,7 +59,7 @@ private static void check(final long request, final long max, final String scale
      * @since 1.29.0
      */
     public static int checkBytes(final int request, final long max) throws MemoryLimitException {
-        check(request, max, Runtime.getRuntime().freeMemory(), BYTES);
+        check(request, max, Runtime.getRuntime().maxMemory(), BYTES);
         return request;
     }
 
@@ -73,7 +73,7 @@ public static int checkBytes(final int request, final long max) throws MemoryLim
      * @since 1.29.0
      */
     public static long checkKiB(final long request, final long max) throws MemoryLimitException {
-        return check(request, max, Runtime.getRuntime().freeMemory() / 1024, KIB);
+        return check(request, max, Runtime.getRuntime().maxMemory() / 1024, KIB);
     }
 
     /** A long instead of int to account for overflow in corrupt files. */