denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] splitting up (d-GetNotes)


From: Richard Shann
Subject: Re: [Denemo-devel] splitting up (d-GetNotes)
Date: Sat, 25 Jul 2009 09:18:31 +0100

On Fri, 2009-07-24 at 21:14 -0500, Jeremiah Benham wrote:
> On Fri, 24 Jul 2009 19:01:43 +0100
> Richard Shann <address@hidden> wrote:
> 
> > On Fri, 2009-07-24 at 12:45 -0500, Jeremiah Benham wrote:
> > > ok. I will modify d-GetNotes to return a space separated string
> > > rather than a null seperated. (d-GetNotes) needs to be fixed anyway
> > > because it
> > > using a gstring that is not freed.  
> > There is an issue here that needs looking into, strings given to
> > scheme which may not be freed. I have put some commented-out code in
> > view.c which represents what I understood from the guile docs about
> > this. (search for dynwind). But I haven't had time to test it out,
> > and as we go on we are getting more of this stuff hanging around ...
> 
> Would you use valgrind to test it? 
I don't know any of these modern tools really. There is a section marked
developers' tools on the gtk documentation site, which I haven't looked
into either. That is partly why I haven't tackled dynwind; getting it
right without some formal method of checking the result is tricky: you
can't be completely sure that it isn't just working by accident.
Although, in practice, after a bit of use you would expect to see it
crash...
> I saw the comments and looked
> dynwind on google. Can we use gstrings in this code or are we
> restricted to things like int and char* ?
I would use GStrings, freeing the structure with g_string_free(..,FALSE)
leaving the freeing of the actual char* to the dynwind system. This is
to be cautious about the memory allocators involved. In principle the
glib system could adopt its own memory allocation layer which would get
screwed up by someone else calling free() on its pointers. So, always
use the glib free functions for glib assigned things, unless they have
been handed over to you for you to free.

Richard




> 
> Jeremiah
> 
> 
> > 
> > Richard
> > 
> > 
> > 
> > 
> > _______________________________________________
> > Denemo-devel mailing list
> > address@hidden
> > http://lists.gnu.org/mailman/listinfo/denemo-devel
> 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]