Re: [gnome-db]memory leak



Hi Rodrigo!

On Mon, 19 Mar 2001, Rodrigo Moya wrote:

> On 17 Mar 2001 15:17:13 +0100, Daniel Wagner wrote:
> > Hi,
> > 
> > I'm bit confused about following code. When I check for memory leaks,
> > memprof finds some. What's wrong? 
> > BTW the code is from gnome-db/lib/gnome-db-login.
> > 
> > #include <glib.h>
> > #include <gda-common.h>
> > #include <liboaf/liboaf.h>
> > 
> > void print_string (gpointer data, gpointer user_data)
> > {
> >   /* do something */
> >   printf ("%s\n", (char*)data);
> > }
> > 
> > int main (int argc, char **argv) 
> > {
> >   GList *list = NULL;
> > 
> >   oaf_init (argc, argv);
> > 
> >   list = gda_list_datasources ();
> >   g_list_foreach (list, (GFunc)print_string, 0);
> >   g_list_foreach (list, (GFunc)g_free, 0);
> >   g_list_free (list);
> >               
> >   return 0;
> > }
> > 
> yes, it's strange, there shouldn't be memory leaks, as you're freeing the memory
> 
> correctly. What functions does memprof say the leak is in?

memprof says that the memory of 'list = gda_list_datasources ()' is not
freed. I copied gda_list_datasources sources into same file (of course different name:) 
and tested again. Then memprof sees in gda_list_datasourses a memory leak:
'dsns = node = gda_dsn_list()'. And again at the end of the function
'dsns' will be freed with 'gda_dsn_free_list(dsns)'. I don't see any memory leaks there.
Therefore I'm not sure about memprof correctness.  

BTW: I'm still working on gnome-db integration into glade. But it takes
me a lot of times to get into gtk and gnome-db stuff. That's actually
the reason why I'm asking about the memory leak. I've a new
property added. But I have really a hard time to get it right. 

Terry Turner <TerryTurner prodigy net> has made a proposal for the
GnomeDbControll thing you have talked about. (I quote him since my
english is not what it should be and specially phrasing what other 
people have written.)

"Just a thought, why can't the invisible widget be invisible during the
normal execution and visiable while in Glade. An invisible widget does not
effect the containers sizing of the window on screen. In Glade have the
invisiable widget set with its visiablity parameter set to not visiable.  Put it in
a containers that only contains invisiable widgets then that row or column
will not appear on screen under nornmal execution.  This could work
unless there is some other issues with containers I'm not seeing."

What to think about that?

wagi

-- 
Daniel Wagner
email: wagi gmx ch

GnuPG: 1024D/DCDE890A (public key available on any keyserver)




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