Ticket #12622 (closed defect: duplicate)
cliquer memory leaks
| Reported by: | jason | Owned by: | jason, ncohen, rlm |
|---|---|---|---|
| Priority: | major | Milestone: | sage-duplicate/invalid/wontfix |
| Component: | graph theory | Keywords: | |
| Cc: | ncohen | Work issues: | |
| Report Upstream: | N/A | Reviewers: | David Coudert, Nathann Cohen |
| Authors: | Jason Grout | Merged in: | |
| Dependencies: | Stopgaps: |
Description
See http://ask.sagemath.org/question/1191/memory-blowup-2 for the initial report. Basically, Sage's interface to cliquer has a number of memory leaks:
- in cliquer.pyx, graph_new is called several times without a corresponding graph_free.
- The lists that are returned from the cliquer functions are not deallocated.
- Inside the cliquer spkg, the cl.c file allocates lots of option structs through calls to sage_init_clique_opt(), but never deallocates them.
Attachments
Change History
comment:3 Changed 15 months ago by jason
I'm not so sure about using sage_free to free memory allocated by cliquer's malloc. Could that cause problems?
Anyways, the attached patch and the above changes make a *huge* difference in memory usage when calculating cliques over a large range of graphs.
comment:4 Changed 14 months ago by dcoudert
- Reviewers set to David Coudert
Apparently this patch is ready to be reviewed, but has still a needs_work status. I tried it and it is working correctly (install, tests, docbuild,...).
However, I don't know how to evaluate the memory improvements. Could you provide an example ?


Here are my changes to the cl.c file inside the cliquer spkg. Do you happen to have time to package these up, Nathann? I was a little confused since usually unmodified source is supposed to be in the src/ directory, but it looks like we have sage-specific stuff in the src/ directory in the cl.c file.