Another test I did was to switch the graphics toolkit to gnuplot. In that case, each new figure results in only a few tens of kilobytes usage. Presumably this is graphics_properties object.
In any case, it points to the problem being with the OpenGL toolkits rather than our overall graphics code.
I don't like the crazy memory usage, but I don't think this is a blocker. It seems quite unusual to create hundreds of figures in an Octave session. Most of the time I find there are only a few open figures and they are re-used for new plots.
|
With the latest sources (stable or default) the qt graphics toolkit is loaded dynamically. So that means you should see a big jump for the first figure as Octave loads the QtOpenGL and dependent libraries. When _init_qt_ is executed it calls mlock, so Octave won't unload the .oct file and libraries. Even after I tried munlock and calling _shutdown_qt_ and clear all, I was unable to get Octave to unload the _init_qt_.oct file.
Apart from the memory allocated to the shared library, I also see the usage go up with figure creation. I'm looking at the value of RSS reported by ps:
So it is increasing by about 13MB for each new figure and only decreasing by about 2MB, though closing the last figure seems to release more.
Here is what I see with fltk:
It's no surprise that fltk is smaller than qt, but I don't understand what's going on with this case because the size appears to increase when closing figures?!?
|
With Octave-6.0.0, M usage on Linux for just an empty figure handle amounts to ~6 MB. Less than on Windows, but still IMO outrageously much.
(checked using the command in a bash shell:
ps -eo size,pid,user,command --sort -size | awk '{ hr=$1/1024 ; printf("%13.2f Mb ",hr) } { for ( x=4 ; x<=NF ; x++ ) { printf("%s ",$x) } print "" }' |cut -d "" -f2 | cut -d "-" -f1 | grep octave
after each "figure" command in Octave, see below)
|
I can confirm that memory consumption has been going up. I tested on a Linux system using self-compiled binaries.
Results for a new figure
Octave 4.2.1 : 24MB
Octave 4.4.1 : 48MB
Octave 5.0.0 : 48MB
The amount might be larger on Windows, but the trend is the problem.
|