-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
MPSolver: Java memory leakage problem #4292
Comments
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 |
can you try with ModelBuilder ? |
If the memory returns to low level, then most likely there are no memory leak. 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. |
this has happened before, and the solution was to tweak the GC parameters on the jvm. |
variables and constraints are owned by the solver. you cannot delete them
yourself.
…--Laurent
|
I tried this after reading what was written in this article |
This is why I encouraged you to switch from MPSolver to Model builder.
Le mar. 2 juil. 2024, 04:53, longhuihy ***@***.***> a écrit :
… variables and constraints are owned by the solver. you cannot delete them
yourself.
… <#m_-8692989398620404696_>
--Laurent
I tried this after reading what was written in this article
https://groups.google.com/g/or-tools-discuss/c/KtrRGXkc8Bo
—
Reply to this email directly, view it on GitHub
<#4292 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3PW2BFCKF6XN5DKNEDZKII2LAVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBRG42TOOJTHA>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Sorry, I am not familiar with how to use Model Builder to model mixed integer programming problems, and I have not found any relevant examples online. Could you please recommend a document or article? Thank you. |
There are examples, in or-tools/linear_solver/samples. They are named
Xxx_Mb.java
Le mer. 3 juil. 2024, 14:31, longhuihy ***@***.***> a écrit :
… Sorry, I am not familiar with how to use Model Builder to model mixed
integer programming problems, and I have not found any relevant examples
online. Could you please recommend a document or article? Thank you.
—
Reply to this email directly, view it on GitHub
<#4292 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MMZAIQKXB32W3BQZTZKPVI5AVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVHE3DMMBWGI>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Thank you. I'll give it a try |
I tried using ModelBuilder's modeling method, but there are still memory leakage issues. The example I am referring to is the ortools/linear_solver/samples/SimpleMipProgramMb. I used the command jcmdGC. run in the container to reclaim memory. The heap memory and out of heap memory have both been reduced to very low levels, but the container memory usage is still high. |
[Heap Memory Usage: init = 4294967296(4194304K) used = 66685936(65122K) committed = 4294967296(4194304K) max = 12884901888(12582912K)] ## '' |
AFAIK, this is not a leak.
Just fragmentation and non reclaimed memory blocks.
There have been long threads on this.
ModelBuilder creates the C++ solver during the solve() call, and deletes it
when it exits.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 4 juil. 2024 à 10:42, longhuihy ***@***.***> a écrit :
… [Heap Memory Usage: init = 4294967296(4194304K) used = 66685936(65122K)
committed = 4294967296(4194304K) max = 12884901888(12582912K)] ## ''
[Non-Heap Memory Usage: init = 7667712(7488K) used = 149457328(145954K)
committed = 152567808(148992K) max = -1(-1K)] ## ''
—
Reply to this email directly, view it on GitHub
<#4292 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3IODHCBJFGHFXL5CN3ZKUDI5AVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGQZTCMRYGM>
.
You are receiving this because you commented.Message ID:
<google/or-tools/issues/4292/2208431283 ***@***.***>
|
The question is does the container restart ? Now how much memory it uses
when nobody wants it.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 4 juil. 2024 à 11:41, Laurent Perron ***@***.***> a écrit :
… AFAIK, this is not a leak.
Just fragmentation and non reclaimed memory blocks.
There have been long threads on this.
ModelBuilder creates the C++ solver during the solve() call, and deletes
it when it exits.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68
53 00
Le jeu. 4 juil. 2024 à 10:42, longhuihy ***@***.***> a
écrit :
> [Heap Memory Usage: init = 4294967296(4194304K) used = 66685936(65122K)
> committed = 4294967296(4194304K) max = 12884901888(12582912K)] ## ''
> [Non-Heap Memory Usage: init = 7667712(7488K) used = 149457328(145954K)
> committed = 152567808(148992K) max = -1(-1K)] ## ''
>
> —
> Reply to this email directly, view it on GitHub
> <#4292 (comment)>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ACUPL3IODHCBJFGHFXL5CN3ZKUDI5AVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYGQZTCMRYGM>
> .
> You are receiving this because you commented.Message ID:
> <google/or-tools/issues/4292/2208431283 ***@***.***>
>
|
The maximum memory limit of the container is set to 18G, and the maximum heap memory size is set to 10G. Although heap memory can be reclaimed, as the number of calls to the solver increases, the total memory continues to increase, ultimately exceeding the container's memory limit and causing the container to restart.This is also the reason why I suspect a memory leak has occurred. |
not my experience.
We do have a strong memory checker internally. They do not flag anything. I
know the swig layer is different, but the model builder has a very small
SWIG surface, so it should no happen.
Can you try with the MPSolver using CBC instead of SCIP ?
If the problem is integral (no continuous variables), can you try CP-SAT
instead of SCIP on the ModelBuilder instance ?
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le jeu. 4 juil. 2024 à 13:25, longhuihy ***@***.***> a écrit :
… The maximum memory limit of the container is set to 18G, and the maximum
heap memory size is set to 10G. Although heap memory can be reclaimed, as
the number of calls to the solver increases, the total memory continues to
increase, ultimately exceeding the container's memory limit and causing the
container to restart.This is also the reason why I suspect a memory leak
has occurred.
—
Reply to this email directly, view it on GitHub
<#4292 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3JFQ7LCSAK2DM7GQRTZKUWJLAVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBYG4ZTEMZRGA>
.
You are receiving this because you commented.Message ID:
<google/or-tools/issues/4292/2208732310 ***@***.***>
|
Has the problem been solved?how? |
@GloryJie |
this is not the same solver.
Laurent Perron | Operations Research | ***@***.*** | (33) 1 42 68 53
00
Le mer. 18 sept. 2024 à 00:32, longhuihy ***@***.***> a
écrit :
… @GloryJie <https://github.com/GloryJie>
I haven't completely solved it yet. I am currently releasing memory
through scheduled restarts
—
Reply to this email directly, view it on GitHub
<#4292 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUPL3MBTAWGFUHXUBJLBGTZXEUBJAVCNFSM6AAAAABKDFVZ2CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJXG4YTMNRXGA>
.
You are receiving this because you commented.Message ID:
<google/or-tools/issues/4292/2357716670 ***@***.***>
|
@longhuihy |
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
The text was updated successfully, but these errors were encountered: