Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[visad] memory leak in visad

I have been using visad and idv classes for offscreen rendering. On long lived apps, using IDV's MapProjectionDisplay, I run out of memory. My apps are of the form

new MapProejctionDisplay
add a DisplayableData
getImage
destroy


Using the jhat heap dump analysis tool in Java6, I think I have found the culprit. visad's DisplayRealType has a static vector into which all instances are added. There is no method to remove instances from this list. So even making sure that names of DisplayRealTypes do not clash, my program leaks.

I am happy to fix this locally in the source code, but am unsure of the implications, even within this one class. Why must names be unique? Can I just add a 'remove by name' method and call this from somewhere, probably MapProjectionDisplay??

I note that in ScalarType, use is made of WeakMapValues, in order to avoid another memory issue relating to static maps. This idiom seems to have not crossed over to DisplayRealType?? It seems like DRT is almost duplicating uniqueness logic already in ScalarType????

Any advice appreciated

Stuart



 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690