Geeqie loads the screen profile for every image. If this is a file, there's no problem — the file itself is read in by lcms and the parsed profile object is dealt with properly in color_man.c.

If the profile is in the X11 _ICC_PROFILE atom, though, the profile data is read and stored "in" a pointer stored on the stack in the image_post_process_color function in image.c. This memory wasn't being freed properly, and would cause a leak the size of the profile for every image that was loaded.

For some people, this might not have been a big deal. For me, I've got a 1.2MB screen profile, and I tend to leave geeqie open and browse through thousands of photos over its lifetime. Needless to say, I figured something was wrong when I saw that geeqie was using upwards of 4GB of memory 8)

Anyway, this patch properly frees the memory. The proper thing to do would be to cache the profile, however. All of those 4 gigs are still being pulled from X11, and that's CPU time that could better be spent elsewhere.

--xsdg
Index: src/image.c
===================================================================
--- src/image.c	(revision 1736)
+++ src/image.c	(working copy)
@@ -351,6 +351,13 @@
 		}
 
 	image_update_util(imd);
+	
+	if (screen_profile)
+		{
+		g_free(screen_profile);
+		screen_profile = NULL;
+		}
+	
 	return !!cm;
 }
 
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geeqie-devel mailing list
Geeqie-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geeqie-devel

Reply via email to