[gambit-list] Cython __cleanup() problem

David Dreisigmeyer dwdreisigmeyer at gmail.com
Wed Jan 5 16:09:23 EST 2011


The "sudo dtruss ipython" prints out a whole bunch of stuff but never
allows me to use a prompt.  I tried it with python also but it doesn't
start.

There was an fflush(stdout) in the C code before the call to
__cleanup().  This code works as long as __cleanup() is commented out:

void gambit_eval( char *in_str )
{
  char *temp;

  temp = eval_string (in_str);
  if (temp != 0){
    printf ("Gambit-C > %s", temp);
  } else {
    printf ("Error: temp == 0");
  }
  ___release_string (temp);
  fflush (stdout);
  ___cleanup ();
}

On Wed, Jan 5, 2011 at 3:16 PM, Marc Feeley <feeley at iro.umontreal.ca> wrote:
>
> On 2011-01-05, at 2:52 PM, David Dreisigmeyer wrote:
>
>> It will print before the call to __cleanup() but not after the call.
>
> Are you sure (I've seen situations where you have to fflush(stdout); after each printf to get the output).
>
> Please run "dtruss ipython" (you may have to do "sudo dtruss ipython") with your code to see all the system calls that are made, which might indicate quickly where things went wrong during the call to ___cleanup.
>
>> What would the downside of not calling __cleanup() be?  (I'm currently
>> using this way.)
>
> The memory for the Scheme heap won't be deallocated (probably not much in this example, but could be as large as the code asked for).  Also, some file descriptors for open files will not be closed.  And the terminal settings will not be restored correctly.  And some signal handlers will still be installed (and under the control of the Gambit runtime).
>
> Marc
>
>



More information about the Gambit-list mailing list