|| | |||Browse by category|
http://www.kbpublisher.com - http://www.kbpublisher.com
[b]text[/b] - Bold text.
[u]text[/u] - Underline text.
[i]text[/i] - Italic text.
[color=green]text[/color] - Colored text.
[url]kbpublisher.com[/url] - kbpublisher.com
[url=kbpublisher.com]text[/url] - text
[email]email@example.com[/email] - firstname.lastname@example.org
[h1]text[/h1] - Caption text.
- item 1
- item 2
- item 1
- item 2
Why memory keeps increasing as new IlvChart instances are created and how to avoid it?
The continuous creation of multiple
IlvChart instances in the same application may lead to increasing amounts of memory usage. This is due to a default
IlvScalableFontManager instance that is included in
This problem can be avoided by explicitly disposing of the font manager of the chart when the chart is no longer used. To do so, call the
dispose() method like this (in JViews 7.5 or later):
or (in JViews 6.5 or earlier):
Another case to take into account regarding the resources used by the
IlvChart is where the chart is used in a Web application environment, on a servlet; there, the chart is not shown in a top window, instead it is added to a hidden window to make it valid and printable to a bitmap - which is the purpose of the servlet.
Upon disposal of the chart, when it is no longer used, the chart must be detached from the window, and the window disposed of itself. This is the code to properly dispose of a chart instance in a servlet.
IlvChart chart = ...;
// JViews 7.5 or later: Dispose of the chart.
// JViews 6.5 or earlier: Dispose the font manager.
java.awt.Container parent = chart.getParent();
java.awt.Component root = javax.swing.SwingUtilities.getRoot(parent);
if (root instanceof java.awt.Window)
Finally, if font scaling is not being used, you can call
chart.getFontManager().dispose() immediately, and let the memory manager handles garbage collection.
Note: This issue has been resolved in JViews 8.8. It is not necessary to explicitly called
dispose() on the chart or the fontManager when using JViews 8.8 or later.