3mcd/javelin

Question: Why menory usage grow in the Doc example?

Closed this issue · 2 comments

In the doc you said

The memory growth (0.3mb) is consistent with standard setInterval or requestAnimationFrame

If you are just iterating, not adding any new components, why there need new memory, what is allocated into new memory?

3mcd commented

Hey, great question. I had the same reaction when I learned about setInterval and requestAnimationFrame. Check out this StackOverflow issue:
https://stackoverflow.com/questions/14034107/does-javascript-setinterval-method-cause-memory-leak

Based on the second answer there, it looks like this is likely just the standard behavior of Chrome DevTools. Here's an outstanding Chrome bug: https://bugs.chromium.org/p/chromium/issues/detail?id=120186

Get it, the slope is caused by interval API, so if the ratio of the slope is constant, it means @javelin/ecs is not allocating any new memory, that is great!

Thanks for your good work!