octave-patch-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-patch-tracker] [patch #9829] Access of a nested structure memory


From: Evangelos Rozos
Subject: [Octave-patch-tracker] [patch #9829] Access of a nested structure memory leak in mex function
Date: Wed, 10 Jul 2019 05:52:10 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:67.0) Gecko/20100101 Firefox/67.0

URL:
  <https://savannah.gnu.org/patch/?9829>

                 Summary: Access of a nested structure memory leak in mex
function
                 Project: GNU Octave
            Submitted by: vrozos
            Submitted on: Wed 10 Jul 2019 09:52:05 AM UTC
                Category: Core : other
                Priority: 5 - Normal
                  Status: None
                 Privacy: Public
             Assigned to: None
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

The access of a nested structure passed to a mex function seems to create
memory leak.

Example code (snippet):
...
 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 of code above does not create directly the
leak, but somehow mixes up the memory management (a dynamic allocation
somewhere else in the code is not freed by free() ). The leak is noticeable
only after numerous calls of the mex function (7.6 MB/100000 calls).

Evangelos Rozos 




    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/patch/?9829>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]