swing JNI how to free memory
I had a class Screen extends JWindow, and this class had a few
ImageIcon icon = new ImageIcon("big jpg");
then in main class, after creating Screen s, did the following:
Runtime r = Runtime.getruntime();
long before = r.freeMemory();
s.icon = null;
s.lable = null;
s = null;
long after = r.freeMemory();
from (after-before), I saw free memory increased a lots, but from some
trace tool, I saw that the reference still there, like
Paths from "GC Roots" to "Object ToolkitImage #004fdf56"
image of javax.swing.ImageIcon
defaultIcon of javax.swing.JLabel
 of java.awt.Component
component of javax.swing.JPanel
contentPane of javax.swing.JRootPane
rootPane of Screen [JNI Global]
consulting the tool vendor, it said the object is referenced by native
called, can't really free up by setting null
I'm wondering, how to clean up such object or free swing component?
|All times are GMT. The time now is 05:38 PM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.