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

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

[Octave-bug-tracker] [bug #52123] Memory leak in cdef_manager::initializ


From: Piotr Held
Subject: [Octave-bug-tracker] [bug #52123] Memory leak in cdef_manager::initialize ()
Date: Wed, 27 Sep 2017 13:27:49 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.78 Safari/537.36

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

What I meant when I was talking about commenting out code was to comment out
the entire cdef_manager::initialize() method (from line 3360
<http://hg.savannah.gnu.org/hgweb/octave/file/e250aeab3c85/libinterp/octave-value/ov-classdef.cc#l3360>
to line 3658
<http://hg.savannah.gnu.org/hgweb/octave/file/e250aeab3c85/libinterp/octave-value/ov-classdef.cc#l3658>
inclusive). This removes all leaks, at least on my system.

I added the code snippet to only show where a recursion occurs. I commented
some code out of the snippet to make it more readable (I wanted the most
important code to be visible).

To describe the recursion in other terms, using the code as is, after line
3368
<http://hg.savannah.gnu.org/hgweb/octave/file/e250aeab3c85/libinterp/octave-value/ov-classdef.cc#l3368>
the  tmp_meta_class.rep->refcount is 5:
0 tmp_meta_class
0 tmp_meta_class.get_rep()->klass (or in other words:
(dynamic_cast&ltcdef_object_base *&gt(tmp_meta_class.rep))->klass )
0 tmp_handle.get_rep()->klass (or in other words:
(dynamic_cast&ltcdef_object_base *&gt(tmp_handle.rep))->klass )
0 m_meta_class
0 entry in cdef_manager::m_all_classes

The recursion exists between instances 1 and 2.
If all of the following:
0 tmp_meta_class
0 tmp_handle (or tmp_handle.get_rep()->klass)
0 m_meta_class
0 cdef_manager::m_all_classes 
get destroyed the tmp_meta_class.rep->refcount will still be 1 (even though
tmp_meta_class itself does not exist). 

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52123>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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