denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] scm_dynwinds etc. [was:] Midi shortcuts


From: R. Mattes
Subject: [Denemo-devel] scm_dynwinds etc. [was:] Midi shortcuts
Date: Wed, 11 May 2011 15:54:04 +0200

On Wed, 11 May 2011 08:15:41 -0500, Jeremiah Benham wrote
> >
> > Jeremiah - do you have time to pick this up again, the tidying up of  
> > the
> > memory leaks in view.c scheme stuff?
> 
> Yes. I have some time to do that. I am a bit confused as to what I  
> need to do now. I'll read over this thread a few more times and ask  
> some questions perhaps.

I think the general approach should be:

* There _are_ situations where scm_dynwind-protection is needed. All calls
  into scheme while resources are temporarily allocated need to be protected
  by setting up a dynwind context _and registering all cleanups with that 
  context_. [Note: very confusing: atm there are calls to scm_dynwind_end
  in functions that don't call scm_dynwind_begin. That's asking for trouble ...)

* Functions that _don't_ call into scheme or that call scheme while there is
  no chance of non-local exits should clean up their locally allocated resources
  themself.

BTW, just a comment on style: while a macro like SCM2LSTRING seems like a good
idea
to save a few keystrokes it's very tempting to write something like:

 scm_dynwind_begin();
 char* my_string = SCM2LSTRING(a_scn_val);
 ....

 scm_dynwind_end();

 ...

 char* foo = my_string;


More questions?

 Cheers, RalfD


--
R. Mattes -
Hochschule fuer Musik Freiburg
address@hidden




reply via email to

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