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 46739ece63f7e1dd41e447901235dc15ddd933f2
Author: Gary D. Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Aug 27 15:50:34 2025 -0400

    Use freeMemory() instead of maxMemory() for object array check
---
 .../org/apache/commons/compress/harmony/pack200/Pack200Exception.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
 
b/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
index 76dd3cdfb..94a30bb2f 100644
--- 
a/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
+++ 
b/src/main/java/org/apache/commons/compress/harmony/pack200/Pack200Exception.java
@@ -95,7 +95,7 @@ public static int checkIntArray(final int size, final int 
count) throws Pack200E
      */
     public static int checkObjectArray(final int size, final int objSize) 
throws Pack200Exception {
         try {
-            MemoryLimitException.checkBytes(Math.multiplyExact(size, objSize), 
Runtime.getRuntime().totalMemory());
+            MemoryLimitException.checkBytes(Math.multiplyExact(size, objSize), 
Runtime.getRuntime().freeMemory());
             return size;
         } catch (final MemoryLimitException | ArithmeticException e) {
             throw new Pack200Exception("Can't allocate %,d Objects of size 
%,d.", size, objSize);

Reply via email to