bugGNU Octave - Bugs: bug #52083, Memory leak during error when...

 
 

bug #52083: Memory leak during error when instantiating child of sealed class

Submitted by:  Piotr Held <jsoh425>
Submitted on:  Thu 21 Sep 2017 07:03:08 PM UTC  
 
Category: InterpreterSeverity: 3 - Normal
Priority: 5 - NormalItem Group: Other
Status: FixedAssigned to: None
Originator Name: Piotr HeldOpen/Closed: Closed
Release: devOperating System: Any

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Thu 21 Sep 2017 08:35:10 PM UTC, comment #2:

Thanks!

Piotr Held <jsoh425>
Thu 21 Sep 2017 08:21:47 PM UTC, comment #1:

I pushed both changesets:

http://hg.savannah.gnu.org/hgweb/octave/rev/1c2f34a2c60d
http://hg.savannah.gnu.org/hgweb/octave/rev/ff973f3e17e3

Closing report.

John W. Eaton <jwe>
Project Administrator
Thu 21 Sep 2017 07:03:08 PM UTC, original submission:

The problem even though small highlights a future problem/opportunity for attribute validation.

The leak occurs when throwing an exception inside cdef_class::make_meta_class, and it just so happens that the only error inside that method is when creating a meta class for a child of a Sealed class. After the error the tree_classdef object associated with the child class is never destroyed.

My solution to the problem is basically to catch the error, call the destructor and rethrow the error. With the simple code (included in memory_leak_patch.diff):

This code would go to parse_fcn_file.

I also believe that attribute validation, which at this point basically doesn't exist, should go inside cdef_class::make_meta_class. This is because attributes can be assigned expressions and, therefore, these expressions need to be evaluated somewhere. If we evaluate them right when parsing the attribute itself we can run into recursion problems which I described in Bug #51377 Comment5 and also documented in documentation.diff.

Piotr Held <jsoh425>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #41861:  memory_leak_patch.diff added by jsoh425 (1KiB - text/x-patch)
file #41862:  documentation.diff added by jsoh425 (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by jwe (Posted a comment)
  • -unavailable- added by jsoh425 (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 4 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu 21 Sep 2017 08:21:47 PM UTCjweStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Thu 21 Sep 2017 07:03:08 PM UTCjsoh425Attached File-=>Added memory_leak_patch.diff, #41861
      Attached File-=>Added documentation.diff, #41862

    Back to the top


    Powered by Savane 3.1-cleanup1