Skip to main content

How do I release a shared license?



  • Patrick Günther

    So, if I do not call dispose on all the models before disposing the environment, the license is not getting released? Could you clarify this for me?

    Because it certainly does not throw an exception and I can still perform optimizations on the model after disposing the environment. This should be clarified in the documentation if that is the case. As it is worded right now,

    The dispose method on a GRBEnv should be called only after you have called
    dispose on all of the models that were created within that environment.

    it sounds to me, that I can just elect to not close the models first, if I'm not going to use them after disposing the environment.


  • Matthias Miltenberger
    Gurobi Staff

    Dear Patrick,

    You are correct in assuming that the license may not be released after the environment is disposed of if there is a model that is still active.

    You should always dispose of all models inside an environment before disposing of the environment as it is stated in the documentation. Otherwise, this can cause undefined behavior even is there is no error or warning message.

    Best regards,


Article is closed for comments.