google / or-tools

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

[java] RoutingModel: memory leak #3446

Open sarthakgangur opened 1 year ago

sarthakgangur commented 1 year ago

What version of OR-Tools and what language are you using? Version: ortools-java-9.4.1874 Language: Java

Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi) RoutingModel Solver

What operating system (Linux, Windows, ...) and version?

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

We are seeing our k8s container memory increase over time ( a few days ) and profiling indicates the leak might be from ortools. Attached a screenshot of memory increase and jeprof profiling snapshot. The JVM metrics look good indicating that there is some native memory leak

Anything else we should know about your project / environment

image

profiling825Latest-20220829-170713

stenix71 commented 11 months ago

I have the same problem when using java MPSolver with CBC in OR-Tools version 9.6.2534. I call MPSolver.delete explicitly when done but the allocated memory keeps building up. I also run the tool in a docker container within Kubernetes. Version 9.6 seems to be a bit better than 9.5 but it is far from acceptable.

Opsiana commented 9 months ago

I have the same problem. My code is Java 17 Spring Boot, deployed as a Docker container and deployed in CloudRun. I have profiled the heap footprint carefully -- the heap is returning to base level after each execution. But the application's memory footprint grows steadily until the container crashes. The footprint grows slowly when the optimizer is not active, but dramatically (locking out 12% of the container's memory) each time the optimizer runs.

ClaudioConsolmagno commented 4 months ago

Adding a link to a comment I made in this other issue about memory leak that may be relevant to this one.