Memory Leak when updating axis ranges on the order of 30MB/hour
- Dominant language
- Python
- Stars
- 305
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
**Problem Description**

Updating the the plot data and plot axis range causes a memory leak when manually set. For long-running applications this will eventually crash the process with a `MemoryError` as all memory will be consumed.
The following data shows the leak is dependent on plot refresh rate.
* 60Hz update rate causes leak of *~30MB/hr*
* 30Hz update rate causes leak of *~15MB/hr*
**Reproduction Steps:**
Please see repo. [here](https://github.com/danieljfarrell/ChacoMemoryLeak) with code reproducing the problem and Jupyter notebook for data analysis.
Call the following code in a loop with different x and y data.
```python
# `plot_data` is instance of ArrayPlotData
# `plot` is instance of Plot
# `new_x` and `new_y` are are numpy arrays
plot_data.set_data("x", new_x)
plot_data.set_data("y", new_y)
plot.range2d.x_range.low = new_xmin
plot.range2d.x_range.high = new_xmax
plot.range2d.y_range.low = new_ymin
plot.range2d.y_range.high = new_ymax
```
**Expected behavior:**
Refreshing the plot data should not leak memory; long running applications should not crash with `MemoryError`.
**OS, Python version:**
* Windows 7, Windows 10, Windows Server 2012 R2
* Python 2.7.8
* wx 2.8.12.1
* traits 4.5.0
* traitsui 4.5.1
* chaco 4.5.0
* enable 4.5.1
* kiva 4.5.1
* pyface 4.5.2
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.