[Top][All Lists]

[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 03:20: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


                 Summary: Access of a nested structure -> memory leak in mex
                 Project: GNU Octave
            Submitted by: vrozos
            Submitted on: Tue 16 Jul 2019 07:19:59 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Segfault, Bus Error, etc.
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 5.1.0
        Operating System: Any



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 it 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 (estimated leak 7.6 MB/100000

Evangelos Rozos 


Reply to this item at:


  Message sent via Savannah

reply via email to

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