我使用背景虚化来绘制许多时间序列(> 100)与内多点(〜20,000)Jupyter实验室笔记本。当执行小区多次在Jupyter的存储器的消耗铬超过400MB每次运行的增加。在多次单元执行后,Chrome 往往会崩溃,通常是在累积了几 GB 的 RAM 使用量时。此外,每次执行后绘图往往会变慢。
Jupyter 中的“清除 [所有] 输出”或“重新启动内核并清除所有输出...”也不会释放任何内存。在经典的Jupyter Notebook以及Firefox或Edge 中,也会出现此问题。
我的 .ipynp 的最小版本:
import numpy as np
from bokeh.io import show, output_notebook
from bokeh.plotting import figure
import bokeh
output_notebook() # See e.g.: https://github.com/bokeh/bokeh-notebooks/blob/master/tutorial/01%20-%20Basic%20Plotting.ipynb
Run Code Online (Sandbox Code Playgroud)
# Just create a list of numpy arrays with random-walks as dataset
ts_length = 20000
n_lines = 100
np.random.seed(0)
dataset = [np.cumsum(np.random.randn(ts_length)) …Run Code Online (Sandbox Code Playgroud)