Closed
Description
Bug report
Bug summary
Code runs out of the memory, uses all of the available RAM, causes notebook crash on google colab.
Code for reproduction
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 280, 0.1)
y = np.sin(x)
for k in range(100):
fig, ax = plt.subplots(6, 2, sharex = True)
fig.set_size_inches(37.33, 21)
for i in range(2):
for j in range(6):
ax[j][i].plot(x, y)
fig.savefig(f'figure{k}.png', dpi = 300)
plt.close(fig)
Actual outcome
Able to save around 38 figures out of 100, and session gets crashed, since RAM gets full.
Expected outcome
Should save all of the figures, with causing no extra RAM usage.
Matplotlib version
- Operating system: Linux
- Matplotlib version (
import matplotlib; print(matplotlib.__version__)
): 3.2.2 / 3.4.1 (tried on both) - Matplotlib backend (
print(matplotlib.get_backend())
): module://ipykernel.pylab.backend_inline - Python version: 3.7.10
- Jupyter version (if applicable): 5.2.2
- Other libraries: numpy: 1.19.5
- Platform: Google Colaboratory