diff options
author | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-06-25 21:52:07 +0200 |
---|---|---|
committer | Daniel M. Pelt <D.M.Pelt@cwi.nl> | 2015-06-25 21:52:07 +0200 |
commit | 9e3472ea9041b8755050427d8bdb8a4701019c55 (patch) | |
tree | 8f494a765a3607afd1c9bac9c592f30536b950a1 /python | |
parent | f1a8bd8d2b62b089a90fef55268e3300581717ed (diff) | |
download | astra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.gz astra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.bz2 astra-9e3472ea9041b8755050427d8bdb8a4701019c55.tar.xz astra-9e3472ea9041b8755050427d8bdb8a4701019c55.zip |
Fix memory leak in configuration code
Diffstat (limited to 'python')
-rw-r--r-- | python/astra/projector3d_c.pyx | 10 | ||||
-rw-r--r-- | python/astra/projector_c.pyx | 10 |
2 files changed, 16 insertions, 4 deletions
diff --git a/python/astra/projector3d_c.pyx b/python/astra/projector3d_c.pyx index 8b978d7..aec9cde 100644 --- a/python/astra/projector3d_c.pyx +++ b/python/astra/projector3d_c.pyx @@ -87,12 +87,18 @@ cdef CProjector3D * getObject(i) except NULL: def projection_geometry(i): cdef CProjector3D * proj = getObject(i) - return utils.configToDict(proj.getProjectionGeometry().getConfiguration()) + cdef Config * cfg = proj.getProjectionGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def volume_geometry(i): cdef CProjector3D * proj = getObject(i) - return utils.configToDict(proj.getVolumeGeometry().getConfiguration()) + cdef Config * cfg = proj.getVolumeGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def weights_single_ray(i, projection_index, detector_index): diff --git a/python/astra/projector_c.pyx b/python/astra/projector_c.pyx index 9aa868e..77c64a4 100644 --- a/python/astra/projector_c.pyx +++ b/python/astra/projector_c.pyx @@ -91,12 +91,18 @@ cdef CProjector2D * getObject(i) except NULL: def projection_geometry(i): cdef CProjector2D * proj = getObject(i) - return utils.configToDict(proj.getProjectionGeometry().getConfiguration()) + cdef Config * cfg = proj.getProjectionGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def volume_geometry(i): cdef CProjector2D * proj = getObject(i) - return utils.configToDict(proj.getVolumeGeometry().getConfiguration()) + cdef Config * cfg = proj.getVolumeGeometry().getConfiguration() + dct = utils.configToDict(cfg) + del cfg + return dct def weights_single_ray(i, projection_index, detector_index): |