Does anyone know anything about this? It seems to come down to SVGDocuments with images on them. Even if you switch to another SVGDocument, the raster/workingRaster seems to hang on to a significant amount of image data. I can eat up 1M or more just switching between SVGDocuments containing (xlink:href) a single PNG ~20kb in size. Either I'm doing something wrong (I've tried JSVGCanvas.flushImageCache()) or maybe I need to create a simple test case that can replicate this? Michael
________________________________ From: Bishop, Michael W. CTR USJFCOM JFL [mailto:[email protected]] Sent: Mon 2/2/2009 1:19 PM To: [email protected] Subject: Memory leak switching documents? Hi all, I'm trying to track down a memory leak in my application and I'm stuck on how to proceed. I've used NetBeans to profile the application and although I'm new to the profiler, it seems to have to do with images. I guess I should present my testing case. I import a number of SVG documents as a "slide show." The user can select any number of images and an SVGDocument is made from each. Basically, each document has an image in its own <g> tag and an additional <g> tag so the user can draw on top of the image in a separate layer. It's a pretty basic document. The test folder I'm using has 20+ images, so that's how many SVGDocuments are being created. I "lose" memory every time I switch pages by calling setDocument(...) on the JSVGCanvas. It appears from profiling that this is mostly due to image loading. The increasing memory seems to come from int[] created as: org.apache.batik.ext.awt.image.codec.png.PNGRegistryEntry$1.run() -> org.apache.batik.ext.awt.image.rendered.AbstractRed.getData() -> org.apache.batik.ext.awt.image.rendered.AbstractRed.getData(java.awt.Rectangle) -> java.awt.image.Raster.createWritableRaster(java.awt.Image.SampleModel, java.awt.Point) -> java.awt.image.SinglePixelPackedSampleModel.createDataBuffer() -> java.awt.image.DataBufferInt.<init> When I switch documents about 10 times, I get an OutOfMemoryException. While I keep the SVGDocuments in memory, I don't load and keep images or JSVGCanvases. It's one JSVGCanvas used to display whatever "slide" (document) the user wants to see. Are there some references I can tell the JSVGCanvas to release? Are there any gotchas I should look for? I'm trying to figure out if I'm doing something wrong specifically in my application or there's a common pitfall that I can be pointed to so I can avoid this memory consumption. Thanks, Michael Bishop --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
<<winmail.dat>>
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
