Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCIP leaks memory #16

Open
ppershing opened this issue Jul 2, 2014 · 3 comments
Open

SCIP leaks memory #16

ppershing opened this issue Jul 2, 2014 · 3 comments
Assignees

Comments

@ppershing
Copy link
Contributor

SCIP solver does not release (some?) of its memory after the model is deleted. This makes it a huge pain to use Numberjack in scripts with solve a lot of problems of big size.

@ppershing
Copy link
Contributor Author

Easy script to reproduce:

import Numberjack as numberjack
import gc


def solve():
        model = numberjack.Model()
        N = 1000
        M = 1000
        variables = [numberjack.Variable(0, 1) for i in range(N)]
        for j in range(M):
                model.add(numberjack.Sum(variables) == 42)
        solver = model.load('SCIP')
        solver.solve()

while True:
        solve()
        print gc.collect()

@9thbit 9thbit self-assigned this Jul 2, 2014
@9thbit
Copy link
Collaborator

9thbit commented Jul 21, 2014

Hi @ppershing, thanks for the bug report. I haven't been able to figure this one out yet, it appears that the memory for the variables is not freed until the program exits. I suspect this is something to do with the swig interface we use, but it requires further work. If you need a workaround for now, you could launch each solve in a separate subprocess.

Barry

@ppershing
Copy link
Contributor Author

Yes, I already used sub-process workaround but it is a bit of a pain to smuggle data between them (so far I used multiprocessing but it requires pickleable data structures). Anyway, the issue is interesting as a different solver (I tried Gurobi) seem to work well and free the memory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants