diff options
-rw-r--r-- | src/java/org/apache/fop/fo/properties/PropertyCache.java | 14 | ||||
-rw-r--r-- | status.xml | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/java/org/apache/fop/fo/properties/PropertyCache.java b/src/java/org/apache/fop/fo/properties/PropertyCache.java index c1f9a985c..6d9adb998 100644 --- a/src/java/org/apache/fop/fo/properties/PropertyCache.java +++ b/src/java/org/apache/fop/fo/properties/PropertyCache.java @@ -76,6 +76,10 @@ public final class PropertyCache { this.ref = old.ref; this.hash = old.hash; } + + public boolean isCleared() { + return (ref == null || ref.get() == null); + } } @@ -116,10 +120,8 @@ public final class PropertyCache { int index = this.hash & (table.length - 1); CacheEntry first = table[index]; - WeakReference ref; for (CacheEntry e = first; e != null; e = e.next) { - ref = e.ref; - if (ref != null && ref.get() == null) { + if (e.isCleared()) { /* remove obsolete entry /* 1. clear value, cause interference for non-blocking get() */ e.ref = null; @@ -127,7 +129,9 @@ public final class PropertyCache { /* 2. clone the segment, without the obsolete entry */ CacheEntry head = e.next; for (CacheEntry c = first; c != e; c = c.next) { - head = new CacheEntry(c, head); + if (!c.isCleared()) { + head = new CacheEntry(c, head); + } } table[index] = head; segment.count--; @@ -177,7 +181,7 @@ public final class PropertyCache { /* launch cleanup in a separate thread, * so it acquires its own lock, and put() * can return immediately */ - Thread cleaner = new Thread(new CacheCleaner(hash)); + Thread cleaner = new Thread(new CacheCleaner(hash), "FOP PropertyCache Cleaner"); cleaner.start(); } } diff --git a/status.xml b/status.xml index 907487123..55e3f52fa 100644 --- a/status.xml +++ b/status.xml @@ -28,6 +28,10 @@ <changes> <release version="FOP Trunk"> + <action context="Code" dev="JM" type="fix"> + Memory Leak fixed in the Property Cache. Fixed by Jeremias Maerki. Reported and Tested By + Chris Bowditch. + </action> <action context="Code" dev="VH" type="fix"> Bugfix in tables: wrong element generation by the merging algorithm when glues must be produced to cope with conditional spaces. The corresponding length was added twice: one in |