Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

answered 13 years ago

Jason Grout gravatar image

It looks to me like there may be several memory leaks in devel/sage/sage/graphs/cliquer.pyx. Notice, for example:

cdef graph_t *g
g=graph_new(graph.order())

But then we never deallocate the g memory. It looks like cliquer/graph.h also defines a graph_free function, and it looks awfully suspicious that we never call it anywhere in that file after we've done a graph_new. We'd have to add graph_free to the cliquer.pxd file as well.

click to hide/show revision 2
No.2 Revision

It looks to me like there may be several memory leaks in devel/sage/sage/graphs/cliquer.pyx. Notice, for example:

cdef graph_t *g
g=graph_new(graph.order())

But then we never deallocate the g memory. It looks like cliquer/graph.h also defines a graph_free function, and it looks awfully suspicious that we never call it anywhere in that file after we've done a graph_new. We'd have to add graph_free to the cliquer.pxd file as well.

Edit: Section B of the cliquer manual says to use graph_free to free the graph given by graph_new.

click to hide/show revision 3
No.3 Revision

It looks to me like there may be several memory leaks in devel/sage/sage/graphs/cliquer.pyx. Notice, for example:

cdef graph_t *g
g=graph_new(graph.order())

But then we never deallocate the g memory. It looks like cliquer/graph.h also defines a graph_free function, and it looks awfully suspicious that we never call it anywhere in that file after we've done a graph_new. We'd have to add graph_free to the cliquer.pxd file as well.

Edit: Section B of the cliquer manual says to use graph_free to free the graph given by graph_new.

Edit 2: There are more memory leaks. I think the list that is returned from the cliquer function calls should be freed with free, and inside the cliquer package, I think the cliquer options structs should be freed (i.e., any call to sage_init_clique_opt() should be saved as a variable and then freed at the end of the function).

click to hide/show revision 4
No.4 Revision

It looks to me like there may be several memory leaks in devel/sage/sage/graphs/cliquer.pyx. Notice, for example:

cdef graph_t *g
g=graph_new(graph.order())

But then we never deallocate the g memory. It looks like cliquer/graph.h also defines a graph_free function, and it looks awfully suspicious that we never call it anywhere in that file after we've done a graph_new. We'd have to add graph_free to the cliquer.pxd file as well.

Edit: Section B of the cliquer manual says to use graph_free to free the graph given by graph_new.

Edit 2: There are more memory leaks. I think the list that is returned from the cliquer function calls should be freed with free, and inside the cliquer package, I think the cliquer options structs should be freed (i.e., any call to sage_init_clique_opt() should be saved as a variable and then freed at the end of the function).

Edit 3: I've moved these findings to http://trac.sagemath.org/sage_trac/ticket/12622 and posted up some preliminary patches and diffs there.