I wrote a branch-and-price algorithm in Python 2.7 which solves several small LP and MIP models by Gurobi 8.1 in each node. The algorithm runs fine at first, it produces both lower bound and upper bounds, solves all of the mentioned models many times. However after solving roughly 200 nodes suddenly Gurobi returns an Out of Memory error!

I have 128 GB of RAM, of which 70% was free all the time during the algorithm execution. The models are written in different files and functions and called (imported) by the main file when necessary.

Is there any hidden option that limits the RAM usage for Gurobi? Is it possible that the previous model builds affect the current one, considering that all of them are in the separate files?

Update: I am using Window 10, Python 2.7.10 64-bit version and Gurobi 8.0.1 64-bit. I tried solving another single model with Gurobi and it could use the RAM without any problem. So I guess there is something wrong with my implementation.

Update2: I have a Class called "Node". During the algorithm I generate many instances of this class and assign three gurobi.Model instances to each them as their attributes. This obviously leads to excessive use of memory. Even frequently deleting Node instances by "del" command did not solve the problem. So I had to reorganize the algorithm to not store any of these gurobi.Model instances which significantly reduced the memory usage. This helped to avoid the Out of memory error. However, I am not sure what was causing the error.

  • 2
    $\begingroup$ @Nat My workstation running on win 10 64bit Python version : Python 2.7.10 (default, May 23 2015, 09:44:00) [MSC v.1500 64 bit (AMD64)] on win32 Gurobi version :8.0.1 win64 $\endgroup$
    – Mehdi
    Commented Jun 23, 2019 at 8:50
  • 4
    $\begingroup$ If you're running Gurobi under 32 bit Windows then you simply won't be able to use 128 Gigabytes of RAM. $\endgroup$ Commented Jun 23, 2019 at 15:31
  • 1
    $\begingroup$ @BrianBorchers or Rob, maybe move your comment to an answer? $\endgroup$ Commented Jun 24, 2019 at 1:54
  • 2
    $\begingroup$ We need a MCVE to be able to recreate your setup and offer a helpful answer. Our Meta hasn't asked for a magic link for MCVE so I've used SO's link instead. We do have make question relevant to others where it's suggested that asking something of general interest (and not a 'somewhere something is wrong' question) will generate more answers. It's not that we don't want to help, it's how could we help with this? $\endgroup$
    – Rob
    Commented Jun 25, 2019 at 8:47
  • 7
    $\begingroup$ @Mehdi if you solved your problem, you can (should?) write up your solution in an answer, and you can accept it if you want. That way the solution will be easier for others to find in the future (comments are not ideal for this), and also you can get some rep if people upvote your answer. $\endgroup$ Commented Jun 26, 2019 at 15:28

2 Answers 2


For anyone reading this after the fact, it is extremely likely that OP was using 32-bit python on 64 bit Windows. This will restrict your memory space to 2GB. (see here: https://stackoverflow.com/questions/18282867/python-32-bit-


The problem was that I stored too many Gurobi models during the algorithm execution, which increase the RAM usage by seconds!! I still don't know why Gurobi returned the "Out of memory" error when there was plenty of memory available!

To future readers, pay attention to what you actually store in your RAM. Keep it simple and store just what you need (for example a float instead of an object!). RAM usage can add up very quickly!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.