On Thu, 2002-11-07 at 14:58, Rhett Aultman wrote:
> I wasn't suggesting using them because they're sexy.  Personally, I don't use 
>Reference objects unless they can't be avoided.  However, collections that use 
>WeakReferences can be a serious help.  Essentially, they can help ensure object 
>cleanup in a more timely fashion than traditional techniques, as an object placed in, 
>say, a WeakHashMap will automatically be garbage collected when the only reference to 
>the object is in the WeakHashMap.  It's a natural safeguard against someone 
>forgetting to dereference an object in a Collection when they're done with it, which 
>results in memory leakage.

The image caching actually uses the WeakHashMap in cvs.
The idea is that during the creation of a document the image will be
load then at some later time output. During this time it has a strong
reference. Once the image is no longer needed by the renderer then it is
placed into a weak hashmap, this may garbage collect if memory is needed
(although I read somewhere that the jvm often gc's first time).
If another document then needs the image it is recovered if available
and strongly referenced until finished with that document.

As for other parts of FOP, I haven't thought of any, usually it is a
case of it is needed or not needed.

> Again, not being a FOP code veteran, I don't know where the points of use might be, 
>but Reference objects and the "weak collections" seem to be a part of the Java API 
>that don't get much coverage, so I wasn't sure if anyone had even considered their 
>use.
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]

Reply via email to