Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Probably want a (2013) in the title. JS GC is a lot better now than back then.

There's 2 main challenges to a pool based approach

1) Knowing up front how much memory you'll need 2) Complex DOM object pooling

In practice 1 gets solved by growing your pool, this also solves the problem with startup delays due to pre-allocation, but you need some way of knowing when to stop growing the pool and potentially evicting/re-using pool members. You can easily find yourself simply having written a much worse garbage collector of your own.

#2 is the realm of things like React-Virtualize. You need to be cognizant of acquiring handles to browser resources, and how to manage those life-cycles. You can end up in a case where your pool is 95% properly managed, but the leaky 5% still makes costly GC pauses.



Memory management/garbage collection is not defined by the JavaScript language specification.

It is 100% vendor specific. As such, each Garbage Collector implementation can behave in any way arbitrary way they see fit.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: