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

Memory management #103

Open
2 tasks
thomasnordquist opened this issue Apr 15, 2019 · 2 comments
Open
2 tasks

Memory management #103

thomasnordquist opened this issue Apr 15, 2019 · 2 comments

Comments

@thomasnordquist
Copy link
Owner

There is the issue of quantity of topics, message history size, message parsing and preview

30.000 topics x 50kb messages => 1.5GB Ram used

Known "bugs"

  • Diffing does not work with large messages. The diffing capability is limited by the message history ring-buffer size. (~20k)
  • Large messages are truncated (~10k)

React Fiber

React fibers memory management is still a little bit mysterious when all topics of a 30.000 topic tree are expanded, there are about 400.000 dom nodes, reacht fiber seems to hold a reference to old nodes when they no longer exist due to React Fiber's "memoization". It is unclear when these references are cleared. When they have finally cleared it appears electron can reclaim almost all of the allocated memory.
In this extreme scenario, it is possible to run out of memory.
We maybe should prohibit actions like "expand all", when there are too many topics in a tree.
It is unlikely one could even fathom this amount of data.

Long term stability

Currently, all topics are stored, the amount of stored messages per topic is limited. However incoming topics names may be generated and may flood the tree over time.
This may cause long-term memory issues. It might be wise to forget very old data when a specific threshold is reached.

Detect and handle out-of-memory

Currently, the app would most likely crash or freeze.
We could clear the message history ring buffers and drop old topics.

@thomasnordquist
Copy link
Owner Author

Memo: research WeakMap and React Fiber, the history Ringbuffer may provoke that react keeps all memoized nodes since the references still exist in the ringbuffer.
Idea: Immutables? Clone instances before presenting them. The tree updates the most, "leaks" the most. (Leak in parenthesis because it is not leaking permanently)

@thomasnordquist
Copy link
Owner Author

I added the base framework for automated leak tests, based on existing UI-Tests.

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

No branches or pull requests

1 participant