Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Andreas L Delmelle
On Jul 20, 2007, at 16:51, Jeremias Maerki wrote: Want to find a memory leak? SAP's memory analyzer is great again to find out all paths to GC roots: As a simplification here, let's assume "cache" (PropertyCache in static variable) is our GC root. Hard references are to "propCache", then

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Andreas L Delmelle
On Jul 20, 2007, at 17:15, Mark C. Allman wrote: Hi Mark Perhaps I'm being a bit dim, but ... Why store the Property as a key and a value both? Just store "" as the value. You can still get a list of all the cached Property objects by calling keySet(). The entries in the Set returned ma

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Mark C. Allman
Perhaps I'm being a bit dim, but ... Why store the Property as a key and a value both? Just store "" as the value. You can still get a list of all the cached Property objects by calling keySet(). The entries in the Set returned may be WeakReference objects, but that's easily dealt with. Just

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Adrian Cumiskey
Attached revised fix. Jeremias Maerki wrote: Adrian, you forgot to account for the case where the GC removes the instance in the worst possible moment and WeakReference.get() returns null. On 20.07.2007 16:33:34 Adrian Cumiskey wrote: Index: src/java/org/apache/fop/fo/properties/PropertyCache

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
Adrian, you forgot to account for the case where the GC removes the instance in the worst possible moment and WeakReference.get() returns null. On 20.07.2007 16:33:34 Adrian Cumiskey wrote: > Index: src/java/org/apache/fop/fo/properties/PropertyCache.java > ===

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
Want to find a memory leak? SAP's memory analyzer is great again to find out all paths to GC roots: Class Name |Shallow Heap |Retained Heap

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Adrian Cumiskey
Fixed my patch and attached it. Adrian. Chris Bowditch wrote: Jeremias Maerki wrote: On 20.07.2007 12:51:33 Chris Bowditch wrote: Jeremias Maerki wrote: On 20.07.2007 11:52:15 Andreas L Delmelle wrote: In addition to that there was a bug in FixedLength.equals() that made the caching

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Andreas L Delmelle
On Jul 20, 2007, at 14:15, Jeremias Maerki wrote: Another argument: Why did Chris have an OutOfMemoryError in the first place that the fix for FixedLengthProperty solved? The OutOfMemoryError doesn't happen anymore because not so many objects are created to actually be filling the memory. T

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Adrian Cumiskey
Whoops, please ignore the patch I just sent, I made a mistake.. :-[ Chris Bowditch wrote: Jeremias Maerki wrote: On 20.07.2007 12:51:33 Chris Bowditch wrote: Jeremias Maerki wrote: On 20.07.2007 11:52:15 Andreas L Delmelle wrote: In addition to that there was a bug in FixedLength.equ

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Adrian Cumiskey
Taking a look at the code and reading the spec :- public class PropertyCache { private Map propCache = Collections.synchronizedMap(new WeakHashMap()); /** * Checks if the given property is present in the cache - if so, returns * a reference to the cached value. Otherwise t

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Chris Bowditch
Jeremias Maerki wrote: On 20.07.2007 12:51:33 Chris Bowditch wrote: Jeremias Maerki wrote: On 20.07.2007 11:52:15 Andreas L Delmelle wrote: In addition to that there was a bug in FixedLength.equals() that made the caching effect-less: http://svn.apache.org/viewvc?view=rev&rev=557934

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
Another argument: Why did Chris have an OutOfMemoryError in the first place that the fix for FixedLengthProperty solved? The OutOfMemoryError doesn't happen anymore because not so many objects are created to actually be filling the memory. If the objects in the cache had been releasable, they would

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
Sorry, but I don't agree. Anyone else? On 20.07.2007 14:01:52 Andreas L Delmelle wrote: > On Jul 20, 2007, at 11:58, Jeremias Maerki wrote: > > > > > Read again: "Implementation note: The value objects in a > > WeakHashMap are > > held by ordinary strong references." That means that all the obj

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Andreas L Delmelle
On Jul 20, 2007, at 11:58, Jeremias Maerki wrote: Read again: "Implementation note: The value objects in a WeakHashMap are held by ordinary strong references." That means that all the object in there can never be released since there never be only a weak reference to the object there. Righ

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
On 20.07.2007 12:51:33 Chris Bowditch wrote: > Jeremias Maerki wrote: > > > On 20.07.2007 11:52:15 Andreas L Delmelle wrote: > > > > > > >>>In addition to that there was a bug in FixedLength.equals() that made > >>>the caching effect-less: > >>>http://svn.apache.org/viewvc?view=rev&rev=557934

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Chris Bowditch
Jeremias Maerki wrote: On 20.07.2007 11:52:15 Andreas L Delmelle wrote: In addition to that there was a bug in FixedLength.equals() that made the caching effect-less: http://svn.apache.org/viewvc?view=rev&rev=557934 That was the most likely cause. The equals() method returning false b

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
On 20.07.2007 11:52:15 Andreas L Delmelle wrote: > On Jul 20, 2007, at 11:19, Jeremias Maerki wrote: > > >> > >> The initial profile shows that instances of WeakHashMap$entry and > >> org.apache.fop.fo.properties.FixedLength continually grow with the > >> life > >> of JVM. > > > > Interesting c

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Andreas L Delmelle
On Jul 20, 2007, at 11:19, Jeremias Maerki wrote: The initial profile shows that instances of WeakHashMap$entry and org.apache.fop.fo.properties.FixedLength continually grow with the life of JVM. Interesting coincidence: That's exactly what Andreas already wrote about in the other thread a

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Chris Bowditch
Chris Bowditch wrote: Andreas L Delmelle wrote: On Jul 19, 2007, at 18:01, Chris Bowditch wrote: Andreas L Delmelle wrote: If there is anything special about that file, you could always post it, but I'll try to see if I can reproduce with a simple FO without special features. If I don

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Jeremias Maerki
On 20.07.2007 10:45:44 Chris Bowditch wrote: > Andreas L Delmelle wrote: > > > On Jul 19, 2007, at 18:15, Andreas L Delmelle wrote: > > > > > > FWIW, I did a quick while(true){...} test with a modified version of > > our ExampleFO2PDF. With basic documents, I can't seem to reproduce it. > >

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Chris Bowditch
Andreas L Delmelle wrote: On Jul 19, 2007, at 18:01, Chris Bowditch wrote: Andreas L Delmelle wrote: If there is anything special about that file, you could always post it, but I'll try to see if I can reproduce with a simple FO without special features. If I don't succeed, I might ask

Re: OutOfMemoryError in current Trunk

2007-07-20 Thread Chris Bowditch
Andreas L Delmelle wrote: On Jul 19, 2007, at 18:15, Andreas L Delmelle wrote: FWIW, I did a quick while(true){...} test with a modified version of our ExampleFO2PDF. With basic documents, I can't seem to reproduce it. The last cycle, I stopped at 1 renderings, but I'm pretty sure it

Re: OutOfMemoryError in current Trunk

2007-07-19 Thread Andreas L Delmelle
On Jul 19, 2007, at 18:15, Andreas L Delmelle wrote: On Jul 19, 2007, at 18:01, Chris Bowditch wrote: Andreas L Delmelle wrote: If there is anything special about that file, you could always post it, but I'll try to see if I can reproduce with a simple FO without special features. If I

Re: OutOfMemoryError in current Trunk

2007-07-19 Thread Andreas L Delmelle
On Jul 19, 2007, at 18:01, Chris Bowditch wrote: Andreas L Delmelle wrote: If there is anything special about that file, you could always post it, but I'll try to see if I can reproduce with a simple FO without special features. If I don't succeed, I might ask you to post your code as

Re: OutOfMemoryError in current Trunk

2007-07-19 Thread Chris Bowditch
Andreas L Delmelle wrote: On Jul 19, 2007, at 16:37, Chris Bowditch wrote: Hi Chris I have been doing a little bit of testing with the current Trunk code and observed that I can generate an OutOfMemoryError simply by submitting the same 2 page document to FOP to render to Postscript over

Re: OutOfMemoryError in current Trunk

2007-07-19 Thread Andreas L Delmelle
On Jul 19, 2007, at 16:37, Chris Bowditch wrote: Hi Chris I have been doing a little bit of testing with the current Trunk code and observed that I can generate an OutOfMemoryError simply by submitting the same 2 page document to FOP to render to Postscript over and over again. After just

OutOfMemoryError in current Trunk

2007-07-19 Thread Chris Bowditch
Fellow Devs, I have been doing a little bit of testing with the current Trunk code and observed that I can generate an OutOfMemoryError simply by submitting the same 2 page document to FOP to render to Postscript over and over again. After just 2,900 renderings FOP dies with OutOfMemoryError.