[Biopython-dev] [Bug 3010] Bio.KDTree is leaking memory
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Fri Mar 5 11:40:05 UTC 2010
http://bugzilla.open-bio.org/show_bug.cgi?id=3010
------- Comment #3 from biopython-bugzilla at maubp.freeserve.co.uk 2010-03-05 06:40 EST -------
I suspect any memory leak is within KDTree.c function KDTree_set_data. Looking
at this I wondered how the memory allocated by KDTree_add_point gets freed.
The following *might* help, but even if I am right, this is at best only a
partial fix:
diff --git a/Bio/KDTree/KDTree.c b/Bio/KDTree/KDTree.c
index d074f26..07cdc1f 100644
--- a/Bio/KDTree/KDTree.c
+++ b/Bio/KDTree/KDTree.c
@@ -621,9 +621,14 @@ int KDTree_set_data(struct KDTree* tree, float *coords,
long
tree->_radius_list = NULL;
}
tree->_count=0;
+ if (tree->_data_point_list) {
+ free(tree->_data_point_list);
+ tree->_data_point_list = NULL;
+ tree->_data_point_list_size = 0;
+ }
/* keep pointer to coords to delete it */
tree->_coords=coords;
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list