The access of a nested
structure passed to a mex function seems to create memory leak.
pmx1= mxGetField(prhs, 0, "InsDmd");
pmxid= mxGetField(pmx1, 0, "id"); // <-- memory leak
stops when commenting this out
This problem has been witnessed in Octave 5.1.0/win64 and Octave
4.2.2/Linux (I believe exists in every platform and recent
Octave version). The same code does not create leak when
compiled in MATLAB.
Apparently, the indicated line code above does not create
directly the leak, but somehow confuses the memory management.
The leak is noticeable only after numerous calls of the mex
function (7.6 MB/100000 calls).
Could you file this as a bug report at bugs.octave.org
? It is
liable to get lost on the mailing list.
When you do file a report, please include the Octave m-file code
that is associated with the mex C code so that the issue can be