Mercurial > octave
changeset 24261:861e12ce7c06
maint: merge stable to default.
author | Rik <rik@octave.org> |
---|---|
date | Thu, 16 Nov 2017 11:55:15 -0800 |
parents | 676bf5131971 |
children | 554c630c9835 |
files | libinterp/dldfcn/__delaunayn__.cc libinterp/dldfcn/__voronoi__.cc libinterp/dldfcn/convhulln.cc |
diffstat | 3 files changed, 33 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/dldfcn/__delaunayn__.cc Wed Nov 15 19:27:09 2017 -0800 +++ b/libinterp/dldfcn/__delaunayn__.cc Thu Nov 16 11:55:15 2017 -0800 @@ -81,7 +81,7 @@ qh_memfreeshort (&curlong, &totlong); if (curlong || totlong) - warning ("__delaunay__: did not free %d bytes of long memory (%d pieces)", + warning ("__delaunayn__: did not free %d bytes of long memory (%d pieces)", totlong, curlong); }
--- a/libinterp/dldfcn/__voronoi__.cc Wed Nov 15 19:27:09 2017 -0800 +++ b/libinterp/dldfcn/__voronoi__.cc Thu Nov 16 11:55:15 2017 -0800 @@ -67,6 +67,19 @@ std::fclose (f); } +static void +free_qhull_memory () +{ + qh_freeqhull (! qh_ALL); + + int curlong, totlong; + qh_memfreeshort (&curlong, &totlong); + + if (curlong || totlong) + warning ("__voronoi__: did not free %d bytes of long memory (%d pieces)", + totlong, curlong); +} + static bool octave_qhull_dims_ok (octave_idx_type dim, octave_idx_type n, const char *who) { @@ -167,6 +180,9 @@ int exitcode = qh_new_qhull (dim, num_points, points.fortran_vec (), ismalloc, cmd_str, outfile, errfile); + + frame.add_fcn (free_qhull_memory); + if (exitcode) error ("%s: qhull failed", caller.c_str ()); @@ -324,16 +340,6 @@ retval = ovl (F, C, at_inf); - // Free memory from Qhull - qh_freeqhull (! qh_ALL); - - int curlong, totlong; - qh_memfreeshort (&curlong, &totlong); - - if (curlong || totlong) - warning ("%s: qhull did not free %d bytes of long memory (%d pieces)", - caller.c_str (), totlong, curlong); - return retval; #else
--- a/libinterp/dldfcn/convhulln.cc Wed Nov 15 19:27:09 2017 -0800 +++ b/libinterp/dldfcn/convhulln.cc Thu Nov 16 11:55:15 2017 -0800 @@ -61,6 +61,19 @@ std::fclose (f); } +static void +free_qhull_memory () +{ + qh_freeqhull (! qh_ALL); + + int curlong, totlong; + qh_memfreeshort (&curlong, &totlong); + + if (curlong || totlong) + warning ("convhulln: did not free %d bytes of long memory (%d pieces)", + totlong, curlong); +} + static bool octave_qhull_dims_ok (octave_idx_type dim, octave_idx_type n, const char *who) { @@ -183,6 +196,9 @@ int exitcode = qh_new_qhull (dim, num_points, points.fortran_vec (), ismalloc, cmd_str, outfile, errfile); + + frame.add_fcn (free_qhull_memory); + if (exitcode) error ("convhulln: qhull failed"); @@ -284,16 +300,6 @@ retval(0) = idx; - // Free memory from Qhull - qh_freeqhull (! qh_ALL); - - int curlong, totlong; - qh_memfreeshort (&curlong, &totlong); - - if (curlong || totlong) - warning ("convhulln: did not free %d bytes of long memory (%d pieces)", - totlong, curlong); - return retval; #else