preact icon indicating copy to clipboard operation
preact copied to clipboard

[draft] potential fix for memory leak

Open developit opened this issue 5 years ago • 4 comments

Just a thought based on the retaining objects seen in #2336.

Fixing this would be another potential upside we'd gain from moving to a persistent backing tree.

developit avatar Feb 13 '20 01:02 developit

Size Change: +18 B (0%)

Total Size: 38.4 kB

Filename Size Change
dist/preact.js 3.71 kB +5 B (0%)
dist/preact.min.js 3.71 kB +5 B (0%)
dist/preact.module.js 3.73 kB +5 B (0%)
dist/preact.umd.js 3.77 kB +3 B (0%)
ℹ️ View Unchanged
Filename Size Change
compat/dist/compat.js 3 kB 0 B
compat/dist/compat.module.js 3.03 kB 0 B
compat/dist/compat.umd.js 3.05 kB 0 B
debug/dist/debug.js 3.08 kB 0 B
debug/dist/debug.module.js 3.07 kB 0 B
debug/dist/debug.umd.js 3.15 kB 0 B
devtools/dist/devtools.js 175 B 0 B
devtools/dist/devtools.module.js 185 B 0 B
devtools/dist/devtools.umd.js 252 B 0 B
hooks/dist/hooks.js 1.05 kB 0 B
hooks/dist/hooks.module.js 1.08 kB 0 B
hooks/dist/hooks.umd.js 1.13 kB 0 B
test-utils/dist/testUtils.js 390 B 0 B
test-utils/dist/testUtils.module.js 392 B 0 B
test-utils/dist/testUtils.umd.js 469 B 0 B

compressed-size-action

github-actions[bot] avatar Feb 13 '20 01:02 github-actions[bot]

Coverage Status

Coverage remained the same at 99.792% when pulling 9957b3210346ba6545ca7515a86971b8ffc23560 on potential-fix-memory-leak into b03fc6e19b7f543c9700085dd47e6353211a217a on master.

coveralls avatar Feb 13 '20 01:02 coveralls

@JoviDeCroock perhaps if we null'd the ._hooks reference when unmounting? The demo in the linked issue continually remounts trees, so it's very likely that this leak happens for unmounted components.

developit avatar Feb 19 '20 02:02 developit

@developit yes that was my initial suggestion but very hooks specific.... I think we need to clean up our afterPaintEffects on unmount as well

JoviDeCroock avatar Feb 19 '20 08:02 JoviDeCroock