Memory leak in bokeh server session.loop_until_closed()

Hi, I’m trying to use the bokeh server according to the section “Connecting with bokeh.client” on the user guide page (very helpful, by the way). I’ve noticed a memory leak in my code, but it is also present in the example code.

I first run “bokeh serve” in a separate command window and then run the first example in that section (ending with “session.loop_until_closed() # run forever”). Monitoring the process, I can see that it consumes 100-200K more memory per second. This is a real bottleneck since I’d like to leave this application running indefinitely.

The issue seems to be with this line;[“y”] = y * step

In my code, I’ve found that when I make this update with anything but a static list I get the leak. For example, if I run;[“y”] = [0]*npts # <-- OK[“y”] = [x for x in range(npts)] # <-- OK[“y”] = data # <-- NOT OK[“y”] = copy.deepcopy(data) # <-- NOT OK

I’m on Win7 with bokeh 0.12.6 under anaconda. Here’s the output of bokeh info:

Python version : 3.6.1 |Anaconda 4.4.0 (64-bit)| (default, May 11 2017, 13:25:24) [MSC v.1900 64 bit (AMD64)]

IPython version : 5.3.0

Bokeh version : 0.12.6

BokehJS static path : c:\users\efield\anaconda3\lib\site-packages\bokeh\server\static

node.js version : (not installed)

npm version : (not installed)

As a side note: I know this method is frowned upon, but I think it works well for me. Of course, I’m open to alternatives. I can discuss more about my use case, but that’s secondary to this issue here (since it arises with the boilerplate demo code).