|
From: | Evangelos Rozos |
Subject: | Access of a nested structure memory leak in mex function |
Date: | Thu, 4 Jul 2019 13:59:11 +0300 |
User-agent: | Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 |
Example code: mxArray* pmx1=NULL; mxArray* pmxid=NULL; pmx1= mxGetField(prhs[0], 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).
Evangelos Rozos
[Prev in Thread] | Current Thread | [Next in Thread] |