JSCIPOpt icon indicating copy to clipboard operation
JSCIPOpt copied to clipboard

Memory leak when using jscip.MessageHandler

Open patrickguenther opened this issue 1 year ago • 5 comments

It's not a large leak but could become a nuisance for long running applications that solve many optimization problems.

The leak was discovered by accident, while debugging an entirely different issue. The attached screenshot shows a heap dump of our application created by visualvm.

image

The number of retained ScipMessageHandler instances only goes up while running more optimization problems and never down even after explicitly invoking garbage collection.

The generated code for jscip.MessageHandler has a close method with an empty body defined. I guess the expected behavior would be that it frees _messagehdlrptr somehow? Or do I need to call some other JSCIP method to free it?

In the meantime, workarounds are:

  • ignore the problem as the leak is not that large
  • don't use message handlers

patrickguenther avatar Nov 27 '24 14:11 patrickguenther