简体   繁体   中英

Memory overflows when streaming data using Bokeh push_notebook()

It seems that there is a memory leak when calling push_notebook() for streaming data to a Bokeh plot in an IPython notebook. You can reproduce it with the following code in an IPython notebook cell:

from bokeh.plotting import *
import numpy as np

output_notebook()

x = np.linspace(0., 1000., 1000)
p = figure()
hold()
p.line(x = x, y = np.sin(x), name = 'y')

def update():
    renderer = p.select(dict(name='y'))
    ds = renderer[0].data_source
    ds.data['y'] = np.sin(a * x)
    ds.push_notebook()

show(p)

a = 1.
while True:
    update()
    a *= 1.1

Not sure if it's supposed to be used that way though.

There is a bug listed here for this issue. https://github.com/bokeh/bokeh/issues/1732

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM