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:
"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:
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
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.
|