Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XYChart: MemoryLeak with LiveData #1901

Open
th3ragex opened this issue Nov 19, 2019 · 7 comments
Open

XYChart: MemoryLeak with LiveData #1901

th3ragex opened this issue Nov 19, 2019 · 7 comments
Labels

Comments

@th3ragex
Copy link

I am currently building a live chart based on your demo and experience increasing lags after several thousands of new values. The memory usage is steadily increasing.

Tested with Chrome 78.0.3904.97 @32bit and Firefox 70.0.1 @64bit

Please try it out: http://jsfiddle.net/vtur7s64/1/

Is there something i can do to lower the memory footprint?

@martynasma
Copy link
Collaborator

Does it get to a point where it starts slowing down or otherwise breaking down?

Browsers are designed to use up a lot of memory if it's available. So it might eat up a significant chunk of memory before GC mechanism even kicks in.

I've run the fiddle you provided for an hour. The memory usage was increasing for a while, until it capped out and did not grow anymore, which is a sign of healthy GC setup. It's not a memory leak.

If you know of steps on how to reproduce a memory leak (memory growing uncontrollably until the tab/browser becomes unusable), please do let me know.

@th3ragex
Copy link
Author

Thank you for your feedback, i will try to isolate my chart code and test it again. I was a bit alarmed by the amount the memory is rising and the flickering on each animation in the 1GB region. Maybe it's caused by my Laptop which starts struggling after GC kicks in.

If i find something i will let you know.

@th3ragex
Copy link
Author

@martynasma : I have modified the fiddle: http://jsfiddle.net/os4kn6yu/3/

After about 28 minutes the IFrame in Fiddle hosting the chart rose up to 1.2 GB Memory footprint (seen in chrome task manager) and crashed.

Note: Switching tabs, locking the PC or minimizing the Chrome window frees memory and/or stops the chart somehow. I had to leave it open/visible and untouched the whole time.

Are you able to reproduce this behavior too?

Screenshot of the task manager half way through:
image

@martynasma
Copy link
Collaborator

OK, this is a wholly new level. Adding new data point every 1ms? Is this realistic desired usage?

There's absolutely no way a chart can process or even react for rejection on continuous updates every 1ms, so I can see how operations can pile up.

@th3ragex
Copy link
Author

th3ragex commented Nov 20, 2019

My naive assumption was to speed it up "a bit" for reproducibility. If it's caused by operations piling up then this is at least for me not relevant since it's not really a realistic scenario. I have 3x 1 to 25 values per Seconds right now.

I have debugged memory and checked my chart implementation a bit further and found something strange. There is dictionary piling up disposed LineSeriesDataItem instances:

image

The dictionary is: lineSeries.dataItemsByAxis['_dictionary']['id-105']['_dictionary']

I will try to get you a working example ASAP.

@th3ragex
Copy link
Author

@martynasma:
Please check: http://jsfiddle.net/e5ok8v7w/2/

I found something strange. If there is series which has no bound items the previously mentioned dictionary fills up. Once an item was added everything gets cleaned up and seems to stay in a non leaking state. (see log outputs in fiddle)

@martynasma
Copy link
Collaborator

Thanks for additional details. We are going to review this.

At this point I'm not sure when this will happen. Seems like a pretty "niche" scenario.

But will keep this open and you updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants