bugGNU Octave - Bugs: bug #64620, Nested functions handles make...


bug #64620: Nested functions handles make stack frames leak

Submitter:  Petter <petter>
Submitted:  Mon 04 Sep 2023 08:53:05 PM UTC
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Sun 01 Oct 2023 04:35:44 PM UTC, comment #3: 

No complaints from CI. Closing as fixed.

Arun Giridhar <arungiridhar>
Group Member
Sun 17 Sep 2023 01:24:57 AM UTC, comment #2: 

Thanks. Tested and pushed to: https://hg.savannah.gnu.org/hgweb/octave/rev/cad9584e7bad

Ready for test.

Arun Giridhar <arungiridhar>
Group Member
Mon 04 Sep 2023 09:27:03 PM UTC, comment #1: 

Nested functions handles make stack frames leak (bug #64620)

If the handle is saved on parent frames.

* libinterp/corefcn/call-stack.cc: Clear static and parent link on frame pop
* libinterp/corefcn/stack-frame.h: Mark closure for all linked accesses.
                                   Fn to clear parent and static link.
* libinterp/octave-value/ov-fcn-handle.cc: Search access links for context frame match
* test/bug-64620/: Tests

I was able to run of of memory by doing:

while true

,from the CLI (top scope).

(file #55108)

Petter <petter>
Mon 04 Sep 2023 08:53:05 PM UTC, original submission:  

A nested function's handle keeps the parent frames alive, and if a handle to the nested function happen to be stored in a parent frame, the circle will prevent destroying the frames.

The same problem applies with a nested nested function's handle, in which storing the handle on the nesting function's frame will form a circle.

Please see supplied patch in next post for remedy.

Petter <petter>


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

Attach Files:

Attached Files
file #55108:  octave_32287.patch added by petter (6KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by arungiridhar (Posted a comment)
  • -email is unavailable- added by petter (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.


    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-01 arungiridhar StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2023-09-17 arungiridhar StatusNone Ready For Test
    2023-09-04 petter Attached File- Added octave_32287.patch, #55108

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code