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

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

[Octave-bug-tracker] [bug #56637] Access of a nested structure -> memory


From: Evangelos Rozos
Subject: [Octave-bug-tracker] [bug #56637] Access of a nested structure -> memory leak in mex function
Date: Tue, 16 Jul 2019 06:00:00 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Follow-up Comment #2, bug #56637 (project octave):

> Do you allocate memory for your pointers?

... 
 mxArray* pmx1=NULL; 
 mxArray* pmxid=NULL; 
 pmx1= mxGetField(prhs[0], 0, "InsDmd"); 
 pmxid= mxGetField(pmx1, i, "id");        // <-- memory leak stops when
commenting this out 
... 

In the code above: 
- prhs[0] is a structure with name, say, Globals, allocated inside Octave and
passed as argument to the mex function,
- InsDmd is an array of structures inside the structure Globals
- id is a member of the structure InsDmd[i].

Why there is a need to allocate memory? I just want to read the data (packed
inside the structure Globals) that are passed from Octave prompt to the mex
function.

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?56637>

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




reply via email to

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