Opened 5 years ago

Last modified 5 years ago

#24660 closed defect

Memory leak in SubgraphSearch — at Version 1

Reported by: Konrad127123 Owned by:
Priority: major Milestone: sage-8.2
Component: graph theory Keywords: memory leak, SubgraphSearch
Cc: Merged in:
Authors: Konrad K. Dabrowski Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by Konrad127123)

In SubgraphSearch? in generic_graph_pyx.pyx

cinit contains the line: self.tmp_array = <int *> sig_malloc(self.ng * sizeof(int))

but dealloc is missing the line: sig_free(self.tmp_array)

This leads to a memory leak, which can be demonstrated with:

g=graphs.PathGraph(4)
f=graphs.CycleGraph(4)
for i in xrange(1,1000000):
    g.subgraph_search(f,induced=True)
    if i%10000==0:
        print(sage.misc.getusage.linux_memory_usage())

Without the missing line, the memory usage keeps increasing (about 32 bytes per iteration). With the line added, the memory usage is constant.

Change History (1)

comment:1 Changed 5 years ago by Konrad127123

  • Authors set to Konrad K. Dabrowski
  • Component changed from PLEASE CHANGE to memleak
  • Description modified (diff)
  • Keywords memory leak SubgraphSearch added
  • Type changed from PLEASE CHANGE to defect
Note: See TracTickets for help on using tickets.