google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
10.75k stars 2.08k forks source link

memory leakage problem #4292

Open longhuihy opened 2 days ago

longhuihy commented 2 days ago

What version of OR-Tools and what language are you using? Version: 9.10.4067

Language: C++/Java/Python/C# Java

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi) SCIP MPSolver solver = new MPSolver("SCIP", MPSolver.OptimizationProblemType.SCIP_MIXED_INTEGER_PROGRAMMING);

What operating system (Linux, Windows, ...) and version? NAME="Oracle Linux Server" VERSION="8.5"

What did you do? The model I am solving is not very large in scale, but I will serially call to solve dozens to hundreds of models of similar scale, resulting in an increase in memory. I will investigate if it is not the JVM's heap memory and out of heap memory because I have printed out the heap memory and out of heap memory, which is likely caused by or-tools memory leakage

What did you expect to see

What did you see instead?

Make sure you include information that can help us debug (full error message, model Proto).

Anything else we should know about your project / environment

longhuihy commented 2 days ago

After performing full GC, both heap and non heap memory decreased to a very low level, but container monitoring showed that there was still a large amount of memory that was not reclaimed, ultimately leading to exceeding the container's limits of memory

lperron commented 2 days ago

can you try with ModelBuilder ?

longhuihy commented 1 day ago
2024-06-30_074921

This is the memory change curve, during which a container automatic restart occurred

lperron commented 7 hours ago

If the memory returns to low level, then most likely there are no memory leak. Just the GC buckling under pressure.

There are some parameters to alleviate this. Or maybe just for a garbage collect after each solve.

longhuihy commented 5 hours ago

image

longhuihy commented 4 hours ago

If the memory returns to low level, then most likely there are no memory leak. Just the GC buckling under pressure.

There are some parameters to alleviate this. Or maybe just for a garbage collect after each solve.

Thanks for your reply. After performing full GC, both heap and non heap memory decreased to a very low level,But the total memory usage of pods is still very high.

Previously, I only called MPSolver. delete() after the solution was completed, but the memory could not be released. I tried calling MPVariable. delete() and MPConstraint. delete() one by one, but encountered an error during execution.

lperron commented 4 hours ago

this has happened before, and the solution was to tweak the GC parameters on the jvm.
It is still possible there is a leak. We do now own the SCIP code. But currently, there is no indication this is the case.

lperron commented 4 hours ago

variables and constraints are owned by the solver. you cannot delete them yourself.

--Laurent