-
Notifications
You must be signed in to change notification settings - Fork 31
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 leaks #131
Comments
You can get something here:
Free releases the license. I thought it only did that, but docs says it free memory!!!! https://www.fico.com/fico-xpress-optimization/docs/latest/solver/optimizer/HTML/XPRSfree.html Not sure about the usage though. From what I understand, free will kill the env. And I understand that the env is a singleton. so you cant have multiple. If that is the case we could have: function Xpress.reset()
Xpress.free()
Xpress.init()
end And the caller must be careful to not have any active instance.
Seems reasonable, but I just ran thousands of problems and called finalize and no issue with that. The extra code does not hurt though. |
Okay so there may be memory persisting between solves, that survive
Yes, I think the solution is: function run_reopt(inputs)
model = direct_model(Xpress.Optimizer())
# ... do stuff
results = get_results(model)
xpress = backend(model)
finalize(xpress)
return results
end
The related problem is this https://jump.dev/announcements/2021/02/22/agreement/ |
agreed
agreed^2 |
This parameter might be relevant also: +1 for contacting FICO at least for suggestions on how to manage memory. also, |
suggest @NLaws should be fine explicitly calling |
@odow Should I also include |
I would do first experiments including gc |
should fix our memory leak! jump-dev/Xpress.jl#131
@NLaws can you add a call to the XPRSpostsolve function after your solve? |
@joaquimg certainly! How do I do that with JuMP (or MathOptInterface)? |
try this: #157 |
What is the |
Can just check out on that PR. |
Thanks @joaquimg. I have the change ready to deploy in our API and I will see if I can make a comparison of the memory growth with and without |
Any news @NLaws ? |
@joaquimg I ran the same test (REoptLite run 1,000 times in a for loop) with |
Note that Xpress 8.13 is available. |
see https://discourse.julialang.org/t/memory-consumption-growth-with-many-large-milps-in-jump/61895/64?u=nlaws for results with postsolve (still see memory growth issue) |
Did you contact FICO for support? What'd they say? |
I contacted FICO regarding upgrading Xpress, but I don't know what to ask them about the memory issue. If you go back in the thread on discourse you can see that solving a problem in a loop using Xpress alone does not lead to a memory "leak". The issue seems related to threading in Julia perhaps. What would you suggest that I ask FICO support? |
Did you run xpress on Mosel or C? The reference test should be with the C API. To simplify such test we could create a .lp file and initialize xpress with it and solve in a loop both in Julia and C. |
I ran the knapsack.mos problem using Mosel with a bash loop. How do I convert the .mos to an .lp file and use the C API to run the .lp in a loop? |
I've gone through and made a bunch of code-tidying changes recently. I didn't come across anything that might have led to a memory leak, so I think I'm going to mark this as a bug in Xpress. The only potential is if memory is retained in the license environment. In which we might need something like: function force_reset()
Xpress.Lib.XPRSfree()
Xpress.Lib.XPRSinit(C_NULL)
return
end I'm very reticent to add this to the finalizer of People probably need to manually call this in their own application. |
I'm very tempted to just close this. I don't think there is much that we can do. |
I took a brief look into @NLaws discourse issue https://discourse.julialang.org/t/memory-consumption-growth-with-many-large-milps-in-jump/61895/52. I don't have an Xpress license, so I didn't run any code. I just skimmed the
finalize
stuff.This is concerning. What is
free
? Does it need to free the license?Xpress.jl/src/Xpress.jl
Lines 50 to 56 in 6f95f15
Is
destroyprob
sufficient to free all memory allocated by Xpress?Xpress.jl/src/helper.jl
Lines 53 to 63 in f15573f
What happens if
destroyprob
is called twice? Does it error? That would prevent someone manually callingfinalize
.Maybe you need something like
The text was updated successfully, but these errors were encountered: