xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thomas.dewe...@kodak.com
Subject Re: AW: memory leak in setTooltip()?
Date Sat, 05 Nov 2005 01:10:21 GMT
Hi Dominik,

"Steiner, Dominik" <Dominik.Steiner@gigatronik.com> wrote on 11/04/2005 
10:36:47 AM:

> I didn't quite understand what you answered me. My situation is, that I 
have 
> one document (a map) and I track on it every 2 seconds GPS points 
(around 
> 100) with tooltips on them.

   It turns out I was wrong and it was adding a new WeakRef to the 
Document
for every tool tip.  It now uses a WeakHashMap to avoid this problem.  I 
have
delivered this to SVN.  You will want to update to the latest version to 
get
the fix.

> But I actually never invoke setTooltip() on the JSVGCanvas. So I was 
wondering
> if Batik did this internally after I set the Title-Node to my GPS 
Points.

   Yes, setToolTip is called when Batik sees a title or desc element as a
child of a rendered graphical element.

> So I'm not sure about the solution you told me... I extend the 
JSVGCanvas but 
> have nothing to do with WeakReferences. Perhaps you can guide me through 
this... :-)
> 
> Dominik 
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: thomas.deweese@kodak.com [mailto:thomas.deweese@kodak.com] 
> Gesendet: Freitag, 4. November 2005 13:40
> An: batik-users@xmlgraphics.apache.org
> Betreff: Re: memory leak in setTooltip()?
> 
> Hi Dominik,
> 
> "Steiner, Dominik" <Dominik.Steiner@gigatronik.com> wrote on 11/04/2005 
> 07:02:40 AM:
> 
> > I?m having a memory leak in my program and profiled it with a memory 
> debugger.
> > 
> > This one showed me that there were a lot of HashMap.Entry instances 
with 
> 
> > growing number, that referred to the toolTipDocs Set in JSVGCanvas.
> > 
> > When you look in the setToolTip(Element elt, String toolTip) Method, 
you 
> see 
> > that new tooltips are added to that Set but never removed, only when 
you 
> 
> > install a new document the Set is cleared.
> 
>         This is true but an entry should only be added for a new 
document
> (as I understand it multiple WeakRefs are '.equal' if they reference
> the same object).  So for this to be a serious leak you would have to
> reference thousands of documents (probably 10's of thousands).
> 
>         Does this really sound like your problem?
> 
> > So, do I miss something? Can someone help me with that?
> 
>         The solution is to use a 
> batik.util.CleanerThread.WeakReferenceCleared
> subclass instead of just WeakReference, and have it remove it's self
> from the Set in it's 'cleared()' method.  This would require some
> locking to ensure that you don't get concurrent modification problems
> on the toolTipDocs Set (since cleared is called in the cleanerThread's 
> Thread).
> 
> > 
> > Thanks in advance.
> > 
> > Dominik Steiner
> > Dipl-Ing. Informationstechnik (BA)
> > GIGATRONIK
> > Gesellschaft für Automobil-
> > elektronikentwicklung mbH
> > Taunusstr. 21
> > 80807 München
> > Telefon +49 (0) 89 / 353 96 80-70
> > Telefax +49 (0) 89 / 353 96 80-99
> > mailto:dominik.steiner@gigatronik.com
> > www.gigatronik.com
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message