harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r531880 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
Date Tue, 24 Apr 2007 11:14:00 GMT
Author: tellison
Date: Tue Apr 24 04:13:59 2007
New Revision: 531880

URL: http://svn.apache.org/viewvc?view=rev&rev=531880
Log:
Apply patch HARMONY-1194 ([classlib][nio] unexpected "Memory Spy! Fixed attempt to free memory
that was not allocated PlatformAddress[xxx]" messages)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java?view=diff&rev=531880&r1=531879&r2=531880
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
Tue Apr 24 04:13:59 2007
@@ -100,18 +100,16 @@
 		AddressWrapper wrapper;
 		synchronized (this) {
 			PlatformAddress shadow = refToShadow.remove(ref);
-			wrapper = memoryInUse.remove(shadow);
+			wrapper = memoryInUse.get(shadow);
+            if (wrapper != null) {
+                // There is a leak if we were not auto-freeing this memory.
+                if (!wrapper.autoFree) {
+                    System.err
+                            .println("Memory Spy! Fixed memory leak by freeing " + wrapper.shadow);
//$NON-NLS-1$
+                }
+                wrapper.shadow.free();
+            }
 		}
         ref.clear();
-		if (wrapper != null) {
-			// There is a leak if we were not auto-freeing this memory.
-			if (!wrapper.autoFree) {
-				System.err
-						.println("Memory Spy! Fixed memory leak by freeing " + wrapper.shadow); //$NON-NLS-1$
-			}
-			memoryInUse.put(wrapper.shadow, wrapper);
-			wrapper.shadow.free();
-		}
-
 	}
 }



Mime
View raw message