-
Notifications
You must be signed in to change notification settings - Fork 13
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
Memory leak in use of clone_for_plugins
within plugins (callbacks)
#159
Comments
Ah, I think I know what it is going on. It is related to |
I'm not sure I agree. The order of operations should be:
Please let me know if I'm missing something here. |
Do the branching rules get freed after the model is solved? When I have time I will test that. |
I added the line #[test]
fn first_branching_rule() {
let model = Model::new()
.hide_output()
.set_longint_param("limits/nodes", 2)
.unwrap() // only call brancher once
.include_default_plugins()
.read_prob("data/test/gen-ip054.mps")
.unwrap();
let br = FirstBranchingRule {
model: model.clone_for_plugins(),
};
let solved = model
.include_branch_rule("", "", 100000, 1000, 1., Box::new(br))
.solve();
assert!(solved.n_nodes() > 1);
panic!("rc-count = {}", Rc::strong_count(&solved.scip))
} and it returns:
😭 |
The variable and constraints should have |
I also added |
29 is way too much 😄 thanks that's very helpful now I can dig in where does it get incremented. |
You should maybe first check if the |
But that would mean either runtime panics or wrapping every return value in variable and constraint methods in a result. To protect against the case that the model frees the |
Or an alternative is to avoid cached variables/constraints (or cache them without the |
Avoiding caching is something I eventually want to do, then no inconsistencies would arise between the internal SCIP state and russcip. I will add an issue to track this and update this comment later. |
An example of the memory leak can be found in the tests of
branchrule.rs
infirst_branching_rule
The text was updated successfully, but these errors were encountered: