harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From le...@apache.org
Subject svn commit: r567974 - /harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
Date Tue, 21 Aug 2007 06:27:25 GMT
Author: leoli
Date: Mon Aug 20 23:27:25 2007
New Revision: 567974

URL: http://svn.apache.org/viewvc?rev=567974&view=rev
Log:
Apply patch for HARMONY-2530( [classlib][util] native memory leak when creating Deflater).

Modified:
    harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java

Modified: harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java?rev=567974&r1=567973&r2=567974&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/archive/src/main/java/java/util/zip/Deflater.java
Mon Aug 20 23:27:25 2007
@@ -17,6 +17,8 @@
 
 package java.util.zip;
 
+import org.apache.harmony.luni.platform.OSResourcesMonitor;
+
 /**
  * The Deflater class is used to compress bytes using the DEFLATE compression
  * algorithm. Deflation is performed by the ZLIB compression library.
@@ -110,7 +112,7 @@
             throw new IllegalArgumentException();
         }
         compressLevel = level;
-        streamHandle = createStream(compressLevel, strategy, noHeader);
+        streamHandle = createStreamWithMemoryEnsurance(compressLevel, strategy, noHeader);
     }
 
     /**
@@ -431,5 +433,9 @@
         return getTotalOutImpl(streamHandle);
     }
 
+    private long createStreamWithMemoryEnsurance(int level, int strategy1, boolean noHeader1){
+        OSResourcesMonitor.ensurePhysicalMemoryCapacity();
+        return createStream(level, strategy1, noHeader1);
+    }
     private native long createStream(int level, int strategy1, boolean noHeader1);
 }



Mime
View raw message