Search code examples
javamemorygurobi

How to track native memory used by Gurobi in Java?


I am using Gurobi in Java with Gurobi's Java API, and I would like to track the full memory footprint of a Gurobi-based solution to a problem with other solutions, such as SAT solvers.

My tests used Java's microbenchmarking harness's (JMH) garbage collection (GC) profiler, but I have become aware that this profiler does not include Gurobi's native memory used during solving.

Can anyone recommend a method to measure Gurobi's native memory on top the Java's heap allocations?


Solution

  • Gurobi environments have an Attribute MaxMemUsed1 which returns gurobi's report of the memory it used to store and solve your model.

    m.get(GRB.IntAttr.MaxMemUsed)