# [SciPy-user] Memory leak in delaunay interpolator

Pauli Virtanen pav@iki...
Thu Jan 17 13:57:35 CST 2008

```Thu, 17 Jan 2008 14:35:50 -0500, william ratcliff wrote:

> Does it still crash if you give it a degenerate list of points?

It removes duplicate points prior to triangulation, and I think the
segfault associated with this is now patched by Robert Kern. But there
are still datasets that it can't diagonalize (raises KeyError now instead
of a hard segfault); I managed to reduce the problematic example in #376
to a simpler one:

>>> import scikits.delaunay as d
>>> import numpy as np
>>> data = np.array([
...     [-1, -1                          ], [-1, 0], [-1, 1],
...     [ 0, -1                          ], [ 0, 0], [ 0, 1],
...     [ 1, -1 - np.finfo(np.float_).eps], [ 1, 0], [ 1, 1],
... ])
>>> tri = d.Triangulation(data[:,0], data[:,1])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/pauli/koodi/proj/delaunay/main/scikits/delaunay/
triangulate.py", line 90, in __init__
self.hull = self._compute_convex_hull()
File "/home/pauli/koodi/proj/delaunay/main/scikits/delaunay/
triangulate.py", line 125, in _compute_convex_hull
hull.append(edges.pop(hull[-1]))
KeyError: 6
>>> data[6,1] = -1
>>> tri = d.Triangulation(data[:,0], data[:,1])
>>> data[6,1] = -1 - 1e6*np.finfo(np.float_).eps
>>> tri = d.Triangulation(data[:,0], data[:,1])

That is, it works only after rounding off the epsilon. Also, it seems to
work if instead of eps, 1e6*eps is subtracted from data[6,1].

--
Pauli Virtanen

```

More information about the SciPy-user mailing list