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
fixed a memory leak. #38
Conversation
Hi there, thank you for your contribution! This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs. If you would like this pull request to remain open please:
NOTE: If this pull request was closed prematurely, please leave a comment. Thanks! |
Hi there, thank you for your contribution! This pull request has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs. If you would like this pull request to remain open please:
NOTE: If this pull request was closed prematurely, please leave a comment. Thanks! |
I think this is a bug. It would be really recommended to fix it. |
I'm looking at the picosat source code, which uses a static void
blocksol (PicoSAT * picosat)
{
int max_idx = picosat_variables (picosat), i;
if (!sol)
{
sol = malloc (max_idx + 1);
memset (sol, 0, max_idx + 1);
}
for (i = 1; i <= max_idx; i++)
sol[i] = (picosat_deref (picosat, i) > 0) ? 1 : -1;
for (i = 1; i <= max_idx; i++)
picosat_add (picosat, (sol[i] < 0) ? i : -i);
picosat_add (picosat, 0);
} I think @Kray-G is probably correct. When we update |
Thank you very much for your submission. Can you take a look at the shorter fix at https://github.com/conda/pycosat/pull/54/files to see if it would solve the same problem, with a bit less pointer indirection? |
Superseded by #54 |
I found this code has a memory leak.
This is a simple fix for that.
Please check it.
A memory will be allocated every time whenever calling
soliter_next
and it will be never freed.This means a memory will be leaked each iteration,
so amount of leaks are increased in proportion to the number of iterations.