Re: gdk_pixbuf_loader_write memory leak
- From: Olexiy Avramchenko <olexiy irtech cn ua>
- To: milton soto <miltonpsoto yahoo com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: gdk_pixbuf_loader_write memory leak
- Date: Wed, 03 Dec 2003 10:59:22 +0200
milton soto wrote:
Hello
I desperately need some help.
The following coded works, but has a memory leak.
Code Description:
The coded will get a raw gray picture from a camera every
30 millisecond . Each image is converted into a jpeg image
(raw_to_jpeg). The jpeg image is then loaded into the loader,
passed to the pixbuf, and render to the display window.
Any help will be gladly appreciated.
Also, is this the quickest way to display a jpeg image???
I dont understand what are you doing... Why do you need raw -> jpeg
conversion ? It consumes CPU time and you getting worse image quality in
result.
You just need to convert your raw pixels to GdkRGB and display it.
The faster (but it works with local X server only) way is:
1. Create shared pixmap.
2. Allocate all pixels (create relation raw pixel -> actual display pixel).
3. Fill pixmap.
4. Put it on screen.
5. Go to 3.
static gboolean update_display (gpointer user_data)
{
<skipped>
gdk_pixbuf_ref(loader_pixbuf);
Dont ref it. You put an additional reference to object, so it will not
be freed after single unref.
gdk_pixbuf_render_to_drawable(loader_pixbuf,
display_area->window,display_area->style->fg_gc[GTK_STATE_NORMAL], 0,
0, 0, 0, 640, 480, GDK_RGB_DITHER_NONE, 0, 0);
gdk_pixbuf_unref(loader_pixbuf);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]