Repository navigation
1.6.2: Fix a memory leak in property bindings #487
Tao-VanJS
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi fellow VanJSers,
Happy halloween! 🎃🎃🎃
I'm happy to announce the release of VanJS
1.6.2. 🎉🎉🎉1.6.2is a minor release. It fixes a memory leak caused by a flaw in VanJS’s garbage collection. Consider this example:Click Remove row, then Increment. In
1.6.1, the title function still runs, increasing its call count from1to2, even though the row is gone. In1.6.2, the count stays at1.1.6.2fixes this by tying property computations and debug validators to the lifetime of their own DOM elements. When an element is removed, VanJS stops rerunning its associated callbacks and removes their state subscriptions during cleanup. This allows the callbacks and their captured data to be garbage-collected even if the source states remain in use, fixing both the memory leak and the unnecessary work. The fix applies to bothvan.jsandvan.debug.js.The TypeScript return type of
van.hydrateis also corrected from a DOM node tovoid; its runtime behavior is unchanged.With the bug fix, the gzipped bundle now weighs
1078 bytes(1.1kB), up from1074 bytes(1.0kB) (4 bytesincrease); the minified bundle is2087 bytes(2.0kB), up from2083 bytes(2.0kB) (4 bytesincrease) - still being the smallest reactive UI framework in the world.❤️ Hope you can enjoy!
All reactions