Re: [Java-gnome-developer] Pixbuf
Brought to you by:
afcowie
|
From: Douglaz <do...@gm...> - 2010-08-27 13:29:19
|
Hey AfC!
Thanks for taking some time to check my code.
You are right, the sample I attached was not properly written. But the
application where I first noticed the issue uses java-gnome only.
So what I did was change the sample code to use java-gnome only, and I
still can see the mem going up.
Any inputs would be very appreciated!
Best regards,
Douglas
Sample code:
import org.gnome.gdk.Event;
import org.gnome.gdk.Pixbuf;
import org.gnome.gtk.Gtk;
import org.gnome.gtk.Widget;
import org.gnome.gtk.Window;
public class Main {
public static void main(String[] arsg) {
Gtk.init(new String[] {});
new Main();
}
public Main() {
super();
Window window = new Window();
window.connect(new Window.DeleteEvent() {
public boolean onDeleteEvent(Widget widget, Event event) {
Gtk.mainQuit();
System.exit(0);
return false;
}
});
window.setTitle("Close to end");
window.show();
for (int i = 0; i < 10; i++) {
new Loader().start();
}
Gtk.main();
}
protected class Loader extends Thread {
@Override
public void run() {
while (true) {
try {
Pixbuf pixbuf = new Pixbuf("camera.jpg");
System.out.println(pixbuf);
// Would set this Pixbuf in an Image to be shown on the
screen;
sleep(200);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
2010/8/27 Andrew Cowie <an...@op...>
> On Thu, 2010-08-26 at 14:54 -0300, Douglaz wrote:
> > import javax.swing.JOptionPane;
> > import org.gnome.gdk.Pixbuf;
>
> You're trying to mix java-gnome and Swing. That's not going to work.
>
> [I could go on at great length about why mixing toolkits is a bad idea,
> but what's relevant here, even if it is briefly "working" for you, is
> that no one can help you diagnose things like memory problems when two
> entirely different mechanisms for talking to the native graphics
> libraries are at play].
>
> AfC
> Sydney
>
>
>
> ------------------------------------------------------------------------------
> Sell apps to millions through the Intel(R) Atom(Tm) Developer Program
> Be part of this innovative community and reach millions of netbook users
> worldwide. Take advantage of special opportunities to increase revenue and
> speed time-to-market. Join now, and jumpstart your future.
> http://p.sf.net/sfu/intel-atom-d2d
> _______________________________________________
> java-gnome-developer mailing list
> jav...@li...
> https://lists.sourceforge.net/lists/listinfo/java-gnome-developer
>
>
|