-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
Description
Description
We noticed an apparent memory leak when calling the SWIG Java wrappers, in our case namely for (repeated) calls to LGBM_BoosterSaveModelToStringSWIG
. Doing so repeatedly keeps piling up more and more leaked memory, for each returned model string.
It seems that a patch with corresponding %newobject
definitions in the swig interface (swig/lightgbmlib.i
) fixes the issue and takes care of the necessary cleanup in the swig-generated code:
%newobject LGBM_BoosterSaveModelToStringSWIG;
%newobject LGBM_BoosterDumpModelSWIG;
Environment info
We are using the wrappers via https://github.com/metarank/lightgbm4j, which includes (in its latest version) LightGBM of v4.4.0
. Using the latest release v4.6.0
instead doesn't change things, but the above %newobject
declarations resolved the memory issues we're seeing.