[SciPy-user] Memory leak in delaunay interpolator

Nils Wagner nwagner@iam.uni-stuttgart...
Wed Jan 16 13:40:33 CST 2008


On Wed, 16 Jan 2008 11:38:02 +0100
  Rob Hetland <hetland@tamu.edu> wrote:
> 
> I'm not sure who else uses the delaunay package (was in 
> 
> scipy.sandbox, now lives in scikits), but I find it 
>indispensable.   
> Today I found what appears to be a memory leak in the 
>interpolator  
> and extrapolator objects.  This simple code demonstrates 
>the leak:
> 
> 
> 
> from scipy.sandbox import delaunay  # or wherever your 
>delaunay  
> package lives these days
> from numpy.random import rand
> 
> xi, yi = rand(2, 1000)
> x, y = rand(2, 100)
> tri = delaunay.Triangulation(xi, yi)
> 
> for n in range(100000):
>    interp = tri.nn_interpolator(rand(1000))
>    z = interp(x, y)
> 
> 
> 
> I tested this code on Mac OS X 10.4, and a recent 
>version of Ubuntu.   
> Both show memory usage increasing consistently through 
>the run.
> 
> Also, while I am here, does anybody have any other 
>advice on 2D  
> interpolation?  3D?  This is something I need to do 
>often, and I am  
> still waiting for the perfect solution to come along.
> 
> -Rob
> 
> ----
> Rob Hetland, Associate Professor
> Dept. of Oceanography, Texas A&M University
> http://pong.tamu.edu/~rob
> phone: 979-458-0096, fax: 979-845-6331
> 
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user

Hi Rob,
  
I have installed delaunay from scratch.
Your code produces a segfault here. I will file a ticket.

from scikits import delaunay # or wherever your delaunay 
package lives these days
from numpy.random import rand

xi, yi = rand(2, 1000)
x, y = rand(2, 100)
tri = delaunay.Triangulation(xi, yi)

for n in range(100000):
     interp = tri.nn_interpolator(rand(1000))
     z = interp(x, y)

(gdb) run hetland.py
Starting program: /usr/bin/python hetland.py
[Thread debugging using libthread_db enabled]
[New Thread 1077176000 (LWP 16333)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1077176000 (LWP 16333)]
0x4045cfb0 in nn_interpolate_unstructured_method 
(self=0x0, args=0x1) at _delaunay.cpp:504
504             CLEANUP
(gdb) bt
#0  0x4045cfb0 in nn_interpolate_unstructured_method 
(self=0x0, args=0x1) at _delaunay.cpp:504
#1  0x4007b583 in PyCFunction_Call () from 
/usr/lib/libpython2.4.so.1.0
#2  0x400b2a91 in PyEval_EvalFrame () from 
/usr/lib/libpython2.4.so.1.0
#3  0x400b4bc1 in PyEval_EvalCodeEx () from 
/usr/lib/libpython2.4.so.1.0
#4  0x4006b13a in function_call () from 
/usr/lib/libpython2.4.so.1.0
#5  0x40053c37 in PyObject_Call () from 
/usr/lib/libpython2.4.so.1.0
#6  0x4005cedb in instancemethod_call () from 
/usr/lib/libpython2.4.so.1.0
#7  0x40053c37 in PyObject_Call () from 
/usr/lib/libpython2.4.so.1.0
#8  0x4008ec2c in slot_tp_call () from 
/usr/lib/libpython2.4.so.1.0
#9  0x40053c37 in PyObject_Call () from 
/usr/lib/libpython2.4.so.1.0
#10 0x400b1f37 in PyEval_EvalFrame () from 
/usr/lib/libpython2.4.so.1.0
#11 0x400b4bc1 in PyEval_EvalCodeEx () from 
/usr/lib/libpython2.4.so.1.0
#12 0x400b4e95 in PyEval_EvalCode () from 
/usr/lib/libpython2.4.so.1.0
#13 0x400cf618 in run_node () from 
/usr/lib/libpython2.4.so.1.0
#14 0x400d0db3 in PyRun_SimpleFileExFlags () from 
/usr/lib/libpython2.4.so.1.0
#15 0x400d137a in PyRun_AnyFileExFlags () from 
/usr/lib/libpython2.4.so.1.0
#16 0x400d750a in Py_Main () from 
/usr/lib/libpython2.4.so.1.0
#17 0x0804871a in main (argc=1, argv=0x1) at 
ccpython.cc:10

Cheers,
           Nils


More information about the SciPy-user mailing list