bugGNU Octave - Bugs: bug #33458, Repeated load() of the same...


bug #33458: Repeated load() of the same subfunction handles eats up memory

Submitted by:  Olaf Till <i7tiol>
Submitted on:  Wed 01 Jun 2011 08:33:02 PM UTC  
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Olaf Till Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment (Rich Markup)

You are not logged in

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


Fri 03 Jan 2014 04:52:52 PM UTC, comment #3: 

This does seem to have been fixed somewhere along the way.  Closing report.

Rik <rik5>
Project Administrator
Fri 03 Jan 2014 04:12:24 PM UTC, comment #2: 

I don't see this problem with 3.8.0.  I put the load command in an infinite loop and watched with top and didn't see the octave process growing.  Could someone confirm and close this report?

John W. Eaton <jwe>
Project Administrator
Wed 26 Sep 2012 03:34:33 PM UTC, comment #1: 

This is still a problem on the development branch (9/26/2012).

Rik <rik5>
Project Administrator
Wed 01 Jun 2011 08:33:02 PM UTC, original submission:  

Release: stable branch, revision 5bf8af73fc34 of 01/06/2011 17:53

Short description: Consider an m-file function that returns a structure with function handles to its subfunctions. If the returned structure is save()ed to a file, each subsequent load() of that file consumes more memory up to memory-exhaustion.

Repeat by:

Install the attached function "subfunction_handles" in Octaves path. Then:

octave:1> a.b = subfunction_handles ();
octave:2> a.c = 1;

"a.c = 1;", and storing the return value in a structure field instead of simply as "a = subfunction_handles ();", are only necessary because of bug #33456. Then:

octave:3> save ("-binary", "testdata.dat", "a")

Now exit and restart Octave. Open a different terminal and from the shell call the "free" utility to examine memory. Then, again from Octave, do repeatedly

octave:1> load ("testdata.dat")

and after each load(), check memory with "free" from the shell.

With each load(), you see used memory going up by roughly 80MB. To be quite sure, I proceeded up to exhaustion of RAM and saw growing use of swap.

(BTW if one tries to exit Octave then, this lasts "forever" --- then sending Octave a SIGTERM makes it crash (glibc reports double free or corruption).)

Some additional notes:

I do know that the re-load()ed subfunction handles can't be used anyway (I noticed the problem described above load()ing data which also contained subfunction handles, but they were not used. With this original data, I had roughly 1GB memory consumption with each load.).

The procedure in "Repeat by" can be varied and a structure with only one of the returned subfunction handles can be save()ed. Then the memory consumption is proportionally less, but still present with each (or curiously rather each second) load(). But even though only one handle is saved in this case, memory consumption still depends on how many subfunction handles had been returned before; and I had the impression (did not check thoroughly) that it also depends on the amount of code in the subfunction bodies.

Olaf Till <i7tiol>
Project Member


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

Attach Files:

Attached Files
file #23492:  subfunction_handles.m added by i7tiol (10KiB - text/x-objcsrc)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by i7tiol (Submitted the item)

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

    Only project members can vote.




    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-01-03 rik5 StatusConfirmed => Fixed
        Open/ClosedOpen => Closed
    2012-09-26 rik5 StatusNone => Confirmed
    2011-06-01 i7tiol Attached File- => Added subfunction_handles.m, #23492

    Back to the top

    Powered by Savane 3.5