Re: Pixbuf loading question



El lun, 07-04-2008 a las 15:23 +0200, nico escribió:
> 
> For creation of thumbnails on an image list ( inside a gtk.Treeview),
> I
> create a pixbuf for each thumbnail.
> 
> After power up of my laptop  , I load the program and my 500 images (
> image loading is made on  background) ,  for the creation of pixbuf, I
> can see many disc access to load the pixbuf ( I use the command
> pixbuf_new_from_file ).

If your application targets GNOME or other freedesktop compliant
environment, you are using a wrong approach. Instead, you should load
the thumbnails from the thumbnails cache. That way you avoid loading
images that could take long to load and resize, and instead load already
scaled pixbufs.

Check the GnomeThumbnail section in libgnomeui.

> 
> Then if I quit the application, and reload the program, The load time
> is
> very short, and I can no more notice disc access. It's like my pixbufs
> stays in memory, and gtk application did not need to reload from file.
> It's very useful for loading time but I don't understand why  and how
> the buffers  "stays in memory"

That's something that the OS does for you.
> 
> How it is possible to force my application to start with the same
> behavior as the first launch ( many disc accces), without rebooting my
> laptop each time (;-() . I need that to optimize the  loading of the
> pixbuf on background.

At least in Linux, I vaguely remember that there's a way to tell the
kernel to empty the cache. If you use Linux, you could ask in a more
kernel oriented mailing list.


Now, going to the specific problem you have: you could try doing a
on-demand load of the thumbnails, like we do in the thumbpane in eog.
That is, instead of loading all the thumbnails in the treeview, load
only the thumbnails for the items currently visible. If you are worried
as well about memory usage, you may optionally unload those that get
hidden on scrolling. Otherwise, keeping them loaded would do fine.

Claudio

-- 
Claudio Saavedra <csaavedra alumnos utalca cl>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]