bugGNU Octave - Bugs: bug #64944, intensively redrawing subplots...


bug #64944: intensively redrawing subplots results in memoryleak, slow performance and crash

Submitter:  None
Submitted:  Wed 29 Nov 2023 01:20:34 PM UTC
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Performance
Status:  Need Info Assigned to:  None
Originator Name:  Richard Originator Email:  -email is unavailable-
Open/Closed:  * Open Release:  * 7.3.0
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup

Thu 30 Nov 2023 02:46:26 PM UTC, comment #4: 

I don't know if this can demonstrate the same issue. 

If you have one figure with the subplots saved.  The data points can be extracted from the saved .ofig file.  If the data point is not he driver of the issue, the issue may be reproduced by re-plotting the same data every 2 sec or another interval.  I don't think I have ever observed Octave completes the amount of data sub-plotting in 2 sec.  This will require the plotting routines in-use only.

Liang Tang <lt1234>
Wed 29 Nov 2023 07:18:49 PM UTC, comment #3: 

at least on windows with 8.4.0, and on ubuntu with octave 9, not seeing any appreciable increase in octave memory usage by, e.g., running demo subplot 4, then

for idx = 1:1000, cla; subplot(224); plot (x,rand(3,11)); endfor

maybe that has to do with the small plot size.  repeating with x = 1:10000, things take a lot longer but i'm still not seeing any memory change.

hopefully the OP has a good example that we can recreate

Nicholas Jankowski <nrjank>
Group Member
Wed 29 Nov 2023 07:12:26 PM UTC, comment #2: 


I would be very interesting in knowing if legend is part of this bug report.  I am on Windows. 

Subplot is very slow for me too.  I don't get crash but I have to be very "economic" in using repetitive open-then-close subplots.   Even for the same subplots (6x2 or 8x2, each subplot contains about two 100 data points curves), I experienced about 50% efficiency hit w/ or w/o legend.    


Liang Tang <lt1234>
Wed 29 Nov 2023 01:36:24 PM UTC, comment #1: 

Please provide a small self-contained example that can be used to reproduce the problem.

John W. Eaton <jwe>
Group administrator
Wed 29 Nov 2023 01:20:34 PM UTC, original submission:  

When creating a single figure with several sublots and redrawing one or more axes in the figure steadily reduces the performance of octave, it also results in ever increasing memory and eventually makes octave core dump and crash.
Platform is fedora 38.
Graphics toolkits qt and fltk show the same behavior.

When the same octave script is rewritten to use multiple figure windows (for each plot 1 figure) instead of having 1 figure window with multiple axes (sub-plots concept) there is no issue.

When redrawing a plot, "clf" clears the resources related to the figure. When multiple sub-plots are used in one figure, "clf" is not feasible, as it clears all sub-plots, hence, "cla" is used to specifically clear the axes.

There must be an issue with cla, causing not only to steadily increase the memory allocation, but also to decrease performance to a point where the window manager starts complaining on octave not responding anymore and ultimately a core dump ends the program (octave).



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

Attach Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by nrjank (Posted a comment)
  • -email is unavailable- added by lt1234 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by None (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.


    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-11-29 jwe StatusNone Need Info

    Back to the top

    Powered by Savane 3.12.
    Corresponding source code