You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2007/04/24 13:14:00 UTC
svn commit: r531880 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/platform/AbstractMemorySpy.java
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();
- }
-
}
}