[Mono-list] PIxbuf loading optimization

Anset mono at anset.org
Tue Feb 21 04:13:07 EST 2006


Hi,

I'm happy it helped.

I know what the commands do but I do not see how "pending gtk events"  
can fill up my swap memmory.
I found that it helps quite by accident. I've been planning on diving 
into the gtk c code, but haven't had the time yet myself.
If you do find the reason why this happens, please let me know! :)

Perhaps the clearing of the pixbuf memm buffers are handled by gtk 
events and due to some optimisation, those events never get handled....

Anyway, just to be clear, with the "while" in front, your program will 
never block since the iteration is only called if an event is actually 
found.

wkr,

Anset.

Salvatore Scarciglia wrote:

>Hi Anset,
>first of all: thanx very much for your hint! It works fine and now my
>application run fast during treeview filling. In the Monodoc I found the
>following description for the method Gtk.Main.Iteration();
>
>"Runs an iteration of the main loop: blocks until an event is received"
>
>I think that Monodoc is not so complete. So I will search more information on
>the Web. 
>
>Kind regards,
>Salvatore
>
>
>On Mon, 20 Feb 2006 17:30:09 +0100
>Anset <Anset at anset.org> wrote:
>
>  
>
>>Hi,
>>
>>In my application, I needed to load a number of pixbufs from file and I 
>>found that if I loaded more that 10 pixbufs, all the memmory on my 
>>system would fill up and all that happened was endless swapping.
>>
>>I was able to solve this by inserting
>>
>>	while (Gtk.Global.EventsPending) Gtk.Main.Iteration();
>>
>>after every pixbuf is handled and added to the Store.
>>
>>It would appear that this way some buffers are cleared(?), freeing up 
>>the used up memmory, avoiding the swapping and my app ran very much faster.
>>
>>I am not using threads but maybe this helps you too.
>>
>>Wkr,
>>
>>Anset.
>>
>>Salvatore Scarciglia wrote:
>>    
>>
>>>Hi all,
>>>I'm developing a small image viewer in mono (mono+glade+monodevelop); my app
>>>works fine but pixbuf loading. I want to read the content of a folder in the
>>>filesystem and, for each image found inside current folder, create a small
>>>thumb in a TreeView with a CellRendererPixBuf and other information about
>>>image. When the folder contain small images, the loading of its content is
>>>fast; but if I try to "browse" a folder containing a lot of wallpaper
>>>(1024x768 images, up to 300kb each one) the application freeze. I've to
>>>wait a few minutes before using the app again. 
>>>I'm using Thread to load the image into a pixbuf object, so the first image
>>>you see in the treeview is a small image, replaced at runtime by the
>>>original picture when the Thread has finished loading it. 
>>>
>>>Any suggestion ?
>>>
>>>Thanx
>>>
>>>
>>>Salvatore ---------------------<|
>>>LAAS --------------------------<|
>>>http://laas.altervista.org ----<|
>>>_______________________________________________
>>>Mono-list maillist  -  Mono-list at lists.ximian.com
>>>http://lists.ximian.com/mailman/listinfo/mono-list
>>>
>>>      
>>>
>_______________________________________________
>Mono-list maillist  -  Mono-list at lists.ximian.com
>http://lists.ximian.com/mailman/listinfo/mono-list
>
>  
>



More information about the Mono-list mailing list