Skip to content

When I use bqplot to draw the browser memory grow up #1600

Open

Description

@RockBB

Browser memory grow up
When I use bqplot to draw, I constantly update the values of x and y in the line. At this point, leaving the current page to another browser page or minimizing the browser will cause two problems: 1. The browser memory occupied by the drawing page will continue to grow until the page crashes; 2. The drawing operation of the drawing page will only be drawn when the interface is continuously open, and will not be drawn when leaving the interface to go to other interfaces.

Test code

import time
import numpy as np  # For numerical programming and multi-dimensional arrays
from bqplot import Lines, LinearScale, Axis, Figure
security_1 = np.cumsum(np.random.randn(200)) + 100.0
security_2 = np.cumsum(np.random.randn(200)) + 100.0

sc_x = LinearScale()
sc_y = LinearScale()

line = Lines(x=np.arange(len(security_1)), y=security_1, scales={"x": sc_x, "y": sc_y}, close_path=True)
ax_x = Axis(scale=sc_x, label="Index")
ax_y = Axis(scale=sc_y, orientation="vertical", label="y-values of Security 1")

fig = Figure(marks=[line], axes=[ax_x, ax_y], title="Security 1", animation_duration=10)
fig
for i in range(10000):
    with fig.hold_sync():
        with line.hold_sync():
            line.x =  np.cumsum(np.random.randn(200)) + 100.0
            line.y = np.cumsum(np.random.randn(200)) + 100.0
            time.sleep(1)

Expected behavior

1、Browser memory remains stable when not in the drawing interface
2、The drawing program continues to complete the drawing when leaving the current drawing interface

Screenshots
图片
图片

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions