[gnome-love] How to know when to free memory.



Hey all,

There is some crucial piece of info that I don't get about the gtk
object system. I'm working on a plugin to gnumeric and am trying to
figure out when the return value from some call into the libraries needs
to be freed. As the maintainer Jody says: "you need to understand the
management semantics of all results and arguments." So here's an example
with questions throughout.



GList *sheets;
Range *range;

The range is defined at: 
http://cvs.gnome.org/lxr/source/gnumeric/src/gnumeric.h#99

Consider this call:
sheets = workbook_sheets (wb);
http://cvs.gnome.org/lxr/source/gnumeric/src/workbook.c#915             
which needs to be freed with:
g_list_free (sheets);                                                   

Similarly consider:
range = sheet_get_extent (aSheet, FALSE);
http://cvs.gnome.org/lxr/source/gnumeric/src/sheet.c#1200
does this need to be freed, and more importantly why/why not? How do I
figure this out?

Thanks for any pointers,
adrian
acuster nature berkeley educational










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