summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Wette <karl.wette@ligo.org>2018-05-10 21:52:28 +1000
committerKarl Wette <karl.wette@ligo.org>2018-05-12 22:25:07 +1000
commit931656bcbe7c2bf37bb5d831b47fab9a38695e91 (patch)
tree1333b7316b8bde05882079be76c2781aa5430f95
parent04357dca210a3e90e464e00c9ed1b71e38807723 (diff)
downloadswig-931656bcbe7c2bf37bb5d831b47fab9a38695e91.tar.gz
Lib/octave: 'octave_exit' not longer exists in Octave >= 4.4
- Instead must register atexit() function, since Octave still cannot clean up its memory usage on exit with SWIG modules
-rw-r--r--Lib/octave/octruntime.swg6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/octave/octruntime.swg b/Lib/octave/octruntime.swg
index e468eb49e..b2fde69c2 100644
--- a/Lib/octave/octruntime.swg
+++ b/Lib/octave/octruntime.swg
@@ -320,6 +320,8 @@ static const char *const SWIG_name_usage = "-*- texinfo -*- \n\
Loads the SWIG-generated module `" SWIG_name_d "'.\n\
@end deftypefn";
+void __swig_atexit__(void) { ::_Exit(0); }
+
DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
static octave_swig_type* module_ns = 0;
@@ -330,7 +332,9 @@ DEFUN_DLD( SWIG_name, args, nargout, SWIG_name_usage ) {
// version 3.4.*, but reappeared in 4.2.*, so turn on for all versions after 3.2.*.
// can be turned off with macro definition.
#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK
-#if SWIG_OCTAVE_PREREQ(3,2,0)
+#if SWIG_OCTAVE_PREREQ(4,4,0)
+ atexit(__swig_atexit__);
+#elif SWIG_OCTAVE_PREREQ(3,2,0)
octave_exit = ::_Exit;
#endif
#endif