xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m.@mherrn.de
Subject Possible Memory Leak in Batik?
Date Wed, 19 Jun 2013 13:32:04 GMT
Hi,

I have an application that contains an SVGCanvas on which it creates a
document and paints some objects. These object are modified each minute.
Since it is much easier to just newly create these objects with the new
values instead of modifying them, I create them again and replace the
original ones with the new ones.

However that leads to an increasing memory usage. I have attached an
example application that shows the effect. It displays a JFrame with a
JSVGCanvas that paints 100 rectangles that are positioned in relation to
the current time.
It is updated every 200ms. This application consumes more and more RAM
until an OutOfMemoryError is thrown.

It seems that the memory is even huger when additionally resetting the
document on the Canvas, with for example:

  canvas.setDocument(canvas.getSVGDocument());

Attached are also two screenshots I took with the Netbeans profiler.
The first one shows the memory usage of this sample application shortly
after the application start.
The second one shows it after around 10 minutes later.

However the most memory in this case is used by a LinkedList. In my real
application it seems that float[] is the mostly used object that gets more
and more.

Regards
Marco
Mime
View raw message