For example PS_all_new_cells in src/sage/groups/perm_gps/partn_ref/data_structures.pyx contains bitset_init(scratch, n) but there is no bitset_free(scratch) anywhere. Does that mean that the function leaks memory?

Then, in src/sage/graphs/independent_sets.pyx the class IndependentSets seems to have a __dealloc__() thas does NOT contain bitset_free(current_set) and so I guess we have exactly same problem that in breadth_first_search() we are just correcting.

As a counter-example, in src/sage/graphs/weakly_chordal.pyx there is function is_long_hole_free() containing

bitset_init(dense_graph, n * n)
if ...:
    bitset_free(dense_graph)
    return ...
bitset_free(dense_graph)
return ...

so that seems to be correct.

I found these by

egrep -R -o 'bitset_init\([[:alnum:].]+,|bitset_free\([[:alnum:].]+' src/sage  
| less

but I suppose that there are better tools for this.

--
Jori Mäntysalo

Reply via email to