[Java-gnome-developer] Pixbuf
Brought to you by:
afcowie
From: Douglaz <do...@gm...> - 2010-08-26 17:54:42
|
Hello everyone! I'm writing a small application which is collecting the image from a few ip cameras and showing them in a grid. In order to do so, I have a few threads collecting the bytes, creating new Pixbuf object with those bytes, and updating a DataColumnPixbuf. I noticed an increase of the memmory usage as time goes by. Should I by using some method in order to free those unused Pixbuf objects? Or is there a way to update these existing objects? Best regards, Douglas ps.: In the following tiny test you can see the memmory increase (checking the system resources): package camera; import javax.swing.JOptionPane; import org.gnome.gdk.Pixbuf; import org.gnome.gtk.Gtk; public class Main { public Main() { super(); Loader loader = new Loader(); loader.start(); JOptionPane.showMessageDialog(null, "Press ok to exit the program"); } public static void main(String[] arsg) { Gtk.init(new String[] {}); new Main(); System.exit(0); } protected class Loader extends Thread { public void run() { while (true) { try { Pixbuf p1 = new Pixbuf("camera.jpg"); Pixbuf p2 = new Pixbuf("camera.jpg"); Pixbuf p3 = new Pixbuf("camera.jpg"); sleep(200); } catch (Exception e) { e.printStackTrace(); } } } } } |