octave-maintainers
[Top][All Lists]
Advanced

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

Re: segfault when embedding the interpreter


From: John W. Eaton
Subject: Re: segfault when embedding the interpreter
Date: Sat, 12 Oct 2013 09:42:11 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12

On 10/12/2013 09:25 AM, John W. Eaton wrote:

Either way, there does seem to be a problem because I don't think it
should be necessary to call clean_up_and_exit unless you need to
process atexit functions. The other memory cleanup things that
clean_up_and_exit performs should be optional.

By "atexit functions" I meant any registered with the Octave
interpreter's atexit function.

Using return or exit to terminate the program will call the C library
atexit function and do some cleanup, calling destructors for global
objects and such.  It's possible that the order that destructors for
global objects are being called is causing trouble.  If we just use
return or exit, we have no way to control that, so maybe it was just
luck that allowed this to work in the past.

If you call _exit instead, you will bypass all the destructors and
simply terminate the program.  When I use that instead of returning, I
don't see a problem.

So, hmm.  If objects do need to be cleaned up in a specific order,
then perhaps calling cleanup_and_exit is necessary.

jwe


reply via email to

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