From: <js...@us...> - 2007-11-14 04:03:47
|
Revision: 4263 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4263&view=rev Author: jswhit Date: 2007-11-13 20:03:46 -0800 (Tue, 13 Nov 2007) Log Message: ----------- squash another mem leak. Modified Paths: -------------- trunk/toolkits/basemap-testing/src/_geos.c trunk/toolkits/basemap-testing/src/_geos.pyx Modified: trunk/toolkits/basemap-testing/src/_geos.c =================================================================== --- trunk/toolkits/basemap-testing/src/_geos.c 2007-11-13 23:29:42 UTC (rev 4262) +++ trunk/toolkits/basemap-testing/src/_geos.c 2007-11-14 04:03:46 UTC (rev 4263) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.7 on Tue Nov 13 16:03:26 2007 */ +/* Generated by Cython 0.9.6.7 on Tue Nov 13 21:03:25 2007 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -1659,7 +1659,7 @@ * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx # <<<<<<<<<<<<<< * bbuffer[2*i+1] = dy - * return b + * GEOSCoordSeq_destroy(cs) */ (__pyx_v_bbuffer[(2 * __pyx_v_i)]) = __pyx_v_dx; @@ -1667,8 +1667,8 @@ * GEOSCoordSeq_getY(cs, i, &dy) * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy # <<<<<<<<<<<<<< + * GEOSCoordSeq_destroy(cs) * return b - * */ (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]) = __pyx_v_dy; } @@ -1676,6 +1676,15 @@ /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":282 * bbuffer[2*i] = dx * bbuffer[2*i+1] = dy + * GEOSCoordSeq_destroy(cs) # <<<<<<<<<<<<<< + * return b + * + */ + GEOSCoordSeq_destroy(__pyx_v_cs); + + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":283 + * bbuffer[2*i+1] = dy + * GEOSCoordSeq_destroy(cs) * return b # <<<<<<<<<<<<<< * * cdef class LineString(BaseGeometry): @@ -1717,9 +1726,9 @@ if (unlikely(!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_b))) return -1; Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_b); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5_geos_ndarray, 1, "b"))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;} - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":293 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":294 * # make sure data is contiguous. * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): # <<<<<<<<<<<<<< @@ -1729,17 +1738,17 @@ __pyx_1 = (!PyArray_ISCONTIGUOUS(__pyx_v_b)); if (__pyx_1) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":294 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":295 * # if not, make a local copy. * if not PyArray_ISCONTIGUOUS(b): * b = b.copy() # <<<<<<<<<<<<<< * * M = b.shape[0] */ - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; goto __pyx_L1;} - __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_copy); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;} + __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; goto __pyx_L1;} + if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_geos_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;} Py_DECREF(((PyObject *)__pyx_v_b)); __pyx_v_b = ((PyArrayObject *)__pyx_3); __pyx_3 = 0; @@ -1747,29 +1756,29 @@ } __pyx_L2:; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":296 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":297 * b = b.copy() * * M = b.shape[0] # <<<<<<<<<<<<<< * self._npts = M * */ - __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;} + __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_b), __pyx_n_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;} if (PyList_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyList_GET_SIZE(__pyx_2)) { __pyx_4 = PyList_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); } else if (PyTuple_CheckExact(__pyx_2) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_2)) { __pyx_4 = PyTuple_GET_ITEM(__pyx_2, 0); Py_INCREF(__pyx_4); } else { - __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;} - __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;} + __pyx_3 = PyInt_FromLong(0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;} + __pyx_4 = PyObject_GetItem(__pyx_2, __pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; } Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyInt_AsLong(__pyx_4); if (unlikely((__pyx_5 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;} + __pyx_5 = PyInt_AsLong(__pyx_4); if (unlikely((__pyx_5 == -1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 297; goto __pyx_L1;} Py_DECREF(__pyx_4); __pyx_4 = 0; __pyx_v_M = __pyx_5; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":297 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":298 * * M = b.shape[0] * self._npts = M # <<<<<<<<<<<<<< @@ -1778,7 +1787,7 @@ */ ((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._npts = __pyx_v_M; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":300 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":301 * * # Create a coordinate sequence * cs = GEOSCoordSeq_create(M, 2) # <<<<<<<<<<<<<< @@ -1787,7 +1796,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(__pyx_v_M,2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":303 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":304 * * # add to coordinate sequence * bbuffer = <double *>b.data # <<<<<<<<<<<<<< @@ -1796,7 +1805,7 @@ */ __pyx_v_bbuffer = ((double (*))__pyx_v_b->data); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":304 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":305 * # add to coordinate sequence * bbuffer = <double *>b.data * for i from 0 <= i < M: # <<<<<<<<<<<<<< @@ -1805,7 +1814,7 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_M; __pyx_v_i++) { - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":305 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":306 * bbuffer = <double *>b.data * for i from 0 <= i < M: * dx = bbuffer[2*i] # <<<<<<<<<<<<<< @@ -1814,7 +1823,7 @@ */ __pyx_v_dx = (__pyx_v_bbuffer[(2 * __pyx_v_i)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":306 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":307 * for i from 0 <= i < M: * dx = bbuffer[2*i] * dy = bbuffer[2*i+1] # <<<<<<<<<<<<<< @@ -1823,7 +1832,7 @@ */ __pyx_v_dy = (__pyx_v_bbuffer[((2 * __pyx_v_i) + 1)]); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":309 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":310 * # Because of a bug in the GEOS C API, * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) # <<<<<<<<<<<<<< @@ -1832,7 +1841,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,__pyx_v_i,__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":310 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":311 * # always set X before Y * GEOSCoordSeq_setX(cs, i, dx) * GEOSCoordSeq_setY(cs, i, dy) # <<<<<<<<<<<<<< @@ -1842,7 +1851,7 @@ GEOSCoordSeq_setY(__pyx_v_cs,__pyx_v_i,__pyx_v_dy); } - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":313 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":314 * * # create LineString * self._geom = GEOSGeom_createLineString(cs) # <<<<<<<<<<<<<< @@ -1851,7 +1860,7 @@ */ ((struct __pyx_obj_5_geos_LineString *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createLineString(__pyx_v_cs); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":314 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":315 * # create LineString * self._geom = GEOSGeom_createLineString(cs) * self.boundary = b # <<<<<<<<<<<<<< @@ -1891,7 +1900,7 @@ Py_INCREF((PyObject *)__pyx_v_self); Py_INCREF(__pyx_v_b); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":322 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":323 * cdef GEOSCoordSeq *cs * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) # <<<<<<<<<<<<<< @@ -1900,7 +1909,7 @@ */ __pyx_v_cs = GEOSCoordSeq_create(1,2); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":323 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":324 * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] # <<<<<<<<<<<<<< @@ -1912,15 +1921,15 @@ } else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 0 && 0 < PyTuple_GET_SIZE(__pyx_v_b)) { __pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 0); Py_INCREF(__pyx_2); } else { - __pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_1 = PyInt_FromLong(0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} + __pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; } - __pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_dx = __pyx_3; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":323 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":324 * # Create a coordinate sequence * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] # <<<<<<<<<<<<<< @@ -1932,15 +1941,15 @@ } else if (PyTuple_CheckExact(__pyx_v_b) && 0 <= 1 && 1 < PyTuple_GET_SIZE(__pyx_v_b)) { __pyx_2 = PyTuple_GET_ITEM(__pyx_v_b, 1); Py_INCREF(__pyx_2); } else { - __pyx_1 = PyInt_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} - __pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_1 = PyInt_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} + __pyx_2 = PyObject_GetItem(__pyx_v_b, __pyx_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; } - __pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; goto __pyx_L1;} + __pyx_3 = PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; goto __pyx_L1;} Py_DECREF(__pyx_2); __pyx_2 = 0; __pyx_v_dy = __pyx_3; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":324 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":325 * cs = GEOSCoordSeq_create(1, 2) * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) # <<<<<<<<<<<<<< @@ -1949,7 +1958,7 @@ */ GEOSCoordSeq_setX(__pyx_v_cs,0,__pyx_v_dx); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":325 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":326 * dx = b[0]; dy = b[1] * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) # <<<<<<<<<<<<<< @@ -1958,7 +1967,7 @@ */ GEOSCoordSeq_setY(__pyx_v_cs,0,__pyx_v_dy); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":326 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":327 * GEOSCoordSeq_setX(cs, 0, dx) * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) # <<<<<<<<<<<<<< @@ -1967,7 +1976,7 @@ */ ((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._geom = GEOSGeom_createPoint(__pyx_v_cs); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":327 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":328 * GEOSCoordSeq_setY(cs, 0, dy) * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 # <<<<<<<<<<<<<< @@ -1975,7 +1984,7 @@ */ ((struct __pyx_obj_5_geos_Point *)__pyx_v_self)->__pyx_base._npts = 1; - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":328 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":329 * self._geom = GEOSGeom_createPoint(cs) * self._npts = 1 * self.boundary = b # <<<<<<<<<<<<<< @@ -2691,13 +2700,13 @@ if (PyObject_SetAttrString(__pyx_m, "Polygon", (PyObject *)&__pyx_type_5_geos_Polygon) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; goto __pyx_L1;} __pyx_ptype_5_geos_Polygon = &__pyx_type_5_geos_Polygon; __pyx_type_5_geos_LineString.tp_base = __pyx_ptype_5_geos_BaseGeometry; - if (PyType_Ready(&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;} - if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; goto __pyx_L1;} + if (PyType_Ready(&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} + if (PyObject_SetAttrString(__pyx_m, "LineString", (PyObject *)&__pyx_type_5_geos_LineString) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;} __pyx_ptype_5_geos_LineString = &__pyx_type_5_geos_LineString; __pyx_type_5_geos_Point.tp_base = __pyx_ptype_5_geos_BaseGeometry; __pyx_type_5_geos_Point.tp_free = _PyObject_GC_Del; - if (PyType_Ready(&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; goto __pyx_L1;} - if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; goto __pyx_L1;} + if (PyType_Ready(&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;} + if (PyObject_SetAttrString(__pyx_m, "Point", (PyObject *)&__pyx_type_5_geos_Point) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;} __pyx_ptype_5_geos_Point = &__pyx_type_5_geos_Point; /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":1 @@ -2746,7 +2755,7 @@ */ initGEOS(__pyx_f_5_geos_notice_h,__pyx_f_5_geos_error_h); - /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":318 + /* "/Users/jsw/python/matplotlib/toolkits/basemap-testing/src/_geos.pyx":319 * cdef class Point(BaseGeometry): * cdef public x,y * def __init__(self, b): # <<<<<<<<<<<<<< Modified: trunk/toolkits/basemap-testing/src/_geos.pyx =================================================================== --- trunk/toolkits/basemap-testing/src/_geos.pyx 2007-11-13 23:29:42 UTC (rev 4262) +++ trunk/toolkits/basemap-testing/src/_geos.pyx 2007-11-14 04:03:46 UTC (rev 4263) @@ -279,6 +279,7 @@ GEOSCoordSeq_getY(cs, i, &dy) bbuffer[2*i] = dx bbuffer[2*i+1] = dy + GEOSCoordSeq_destroy(cs) return b cdef class LineString(BaseGeometry): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |