Skip to content

Clean up nextEffect pointer - #16115

Merged
sebmarkbage merged 1 commit into
react:masterfrom
paulshen:cleanup-next-effect
Jul 18, 2019
Merged

Clean up nextEffect pointer#16115
sebmarkbage merged 1 commit into
react:masterfrom
paulshen:cleanup-next-effect

Conversation

@paulshen

Copy link
Copy Markdown
Contributor

This change clears the nextEffect reference when it is no longer needed. If there are no passive effects, we iterate through the effect chain after committing host/layout effects. Otherwise, we remove the pointer while flushing passive effects. Pulled from #15157

Without this change, it is possible for live Fiber nodes to have nextEffect pointers to unmounted Fiber nodes.

Repro

https://gist.github.com/paulshen/8a10c1ac7cd1b2983219e27a08d0f85b
Click "Increment" many times and notice that all unmounted <InnerBody> Fiber nodes are retained via a nextEffect chain from <Sidebar>'s Fiber node.

image

With this change, <Sidebar>'s Fiber node has an empty nextEffect reference.

@sizebot

Copy link
Copy Markdown

ReactDOM: size: 0.0%, gzip: 0.0%

Details of bundled changes.

Comparing: 3f1dee0...5f94d0f

react-art

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-art.development.js+0.1%+0.1%628.14 KB628.64 KB137.93 KB138.05 KBUMD_DEV
react-art.production.min.js🔺+0.1%0.0%102.2 KB102.28 KB31.26 KB31.28 KBUMD_PROD
react-art.development.js+0.1%+0.1%559 KB559.5 KB120.55 KB120.68 KBNODE_DEV
react-art.production.min.js🔺+0.1%🔺+0.1%67.25 KB67.33 KB20.6 KB20.63 KBNODE_PROD
ReactART-dev.js+0.1%+0.1%572.1 KB572.6 KB120.15 KB120.28 KBFB_WWW_DEV
ReactART-prod.js🔺+0.1%🔺+0.1%218.6 KB218.88 KB37.11 KB37.16 KBFB_WWW_PROD

react-dom

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-dom.profiling.min.js+0.1%+0.1%114.94 KB115.01 KB36.25 KB36.28 KBNODE_PROFILING
react-dom-server.browser.development.js0.0%0.0%135.74 KB135.74 KB35.81 KB35.81 KBUMD_DEV
ReactDOM-dev.js+0.1%+0.1%914.66 KB915.17 KB203.44 KB203.57 KBFB_WWW_DEV
react-dom-server.browser.production.min.js0.0%0.0%19.34 KB19.34 KB7.23 KB7.23 KBUMD_PROD
react-dom-test-utils.development.js0.0%0.0%57.96 KB57.96 KB15.91 KB15.91 KBUMD_DEV
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.78 KB3.78 KB1.52 KB1.52 KBUMD_DEV
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.3%1.21 KB1.21 KB704 B706 BUMD_PROD
react-dom-test-utils.development.js0.0%0.0%56.22 KB56.22 KB15.59 KB15.59 KBNODE_DEV
react-dom-unstable-fizz.browser.development.js0.0%+0.1%3.61 KB3.61 KB1.47 KB1.48 KBNODE_DEV
react-dom-test-utils.production.min.js0.0%0.0%10.71 KB10.71 KB3.94 KB3.94 KBNODE_PROD
react-dom-unstable-fizz.browser.production.min.js0.0%🔺+0.3%1.05 KB1.05 KB635 B637 BNODE_PROD
react-dom.development.js+0.1%+0.1%891.93 KB892.43 KB203.04 KB203.17 KBUMD_DEV
react-dom.production.min.js🔺+0.1%🔺+0.1%111.21 KB111.31 KB35.81 KB35.83 KBUMD_PROD
react-dom.profiling.min.js+0.1%0.0%114.66 KB114.74 KB36.85 KB36.86 KBUMD_PROFILING
react-dom.development.js+0.1%+0.1%886.21 KB886.72 KB201.53 KB201.66 KBNODE_DEV
react-dom-server.node.development.js0.0%0.0%133.8 KB133.8 KB35.43 KB35.43 KBNODE_DEV
react-dom.production.min.js🔺+0.1%🔺+0.1%111.29 KB111.38 KB35.32 KB35.35 KBNODE_PROD
react-dom-server.node.production.min.js0.0%0.0%20.11 KB20.11 KB7.54 KB7.54 KBNODE_PROD
ReactDOM-prod.js🔺+0.1%🔺+0.1%371.01 KB371.53 KB68.03 KB68.09 KBFB_WWW_PROD
ReactDOM-profiling.js+0.1%0.0%377.34 KB377.59 KB69.37 KB69.4 KBFB_WWW_PROFILING
react-dom-server.browser.development.js0.0%0.0%131.88 KB131.88 KB34.88 KB34.88 KBNODE_DEV
react-dom-server.browser.production.min.js0.0%0.0%19.26 KB19.26 KB7.24 KB7.24 KBNODE_PROD
react-dom-unstable-native-dependencies.development.js0.0%0.0%60.76 KB60.76 KB15.84 KB15.85 KBUMD_DEV
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%10.74 KB10.74 KB3.68 KB3.68 KBUMD_PROD
ReactDOMServer-dev.js0.0%0.0%134.27 KB134.27 KB34.44 KB34.45 KBFB_WWW_DEV
ReactDOMServer-prod.js0.0%0.0%46.67 KB46.67 KB10.74 KB10.74 KBFB_WWW_PROD
react-dom-unstable-native-dependencies.development.js0.0%0.0%60.43 KB60.43 KB15.72 KB15.72 KBNODE_DEV
react-dom-unstable-fizz.node.development.js0.0%+0.1%3.85 KB3.85 KB1.5 KB1.5 KBNODE_DEV
react-dom-unstable-native-dependencies.production.min.js0.0%🔺+0.1%10.48 KB10.48 KB3.58 KB3.58 KBNODE_PROD
react-dom-unstable-fizz.node.production.min.js0.0%🔺+0.2%1.1 KB1.1 KB666 B667 BNODE_PROD

react-native-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactNativeRenderer-prod.js🔺+0.1%🔺+0.1%272.23 KB272.51 KB46.78 KB46.84 KBRN_OSS_PROD
ReactNativeRenderer-profiling.js+0.1%+0.1%279.66 KB280.05 KB48.3 KB48.34 KBRN_OSS_PROFILING
ReactFabric-prod.js🔺+0.1%🔺+0.1%266.42 KB266.7 KB45.94 KB45.99 KBRN_OSS_PROD
ReactFabric-profiling.js+0.1%+0.1%274.43 KB274.79 KB47.36 KB47.4 KBRN_OSS_PROFILING
ReactFabric-dev.js+0.1%+0.1%720.66 KB721.17 KB153.42 KB153.54 KBRN_FB_DEV
ReactFabric-prod.js🔺+0.1%🔺+0.1%266.42 KB266.7 KB45.96 KB46 KBRN_FB_PROD
ReactNativeRenderer-dev.js+0.1%+0.1%707.09 KB707.6 KB150.8 KB150.92 KBRN_OSS_DEV
ReactFabric-profiling.js+0.1%+0.1%274.43 KB274.79 KB47.37 KB47.41 KBRN_FB_PROFILING
ReactNativeRenderer-dev.js+0.1%+0.1%707.19 KB707.69 KB150.85 KB150.97 KBRN_FB_DEV
ReactNativeRenderer-prod.js🔺+0.1%🔺+0.1%272.23 KB272.51 KB46.79 KB46.85 KBRN_FB_PROD
ReactNativeRenderer-profiling.js+0.1%+0.1%279.65 KB280.04 KB48.3 KB48.35 KBRN_FB_PROFILING
ReactFabric-dev.js+0.1%+0.1%720.56 KB721.06 KB153.37 KB153.49 KBRN_OSS_DEV

react-test-renderer

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
ReactTestRenderer-dev.js+0.1%+0.1%582.02 KB582.52 KB122.48 KB122.61 KBFB_WWW_DEV
react-test-renderer-shallow.development.js0.0%0.0%41.46 KB41.46 KB10.78 KB10.79 KBUMD_DEV
react-test-renderer-shallow.production.min.js0.0%0.0%11.66 KB11.66 KB3.56 KB3.56 KBUMD_PROD
react-test-renderer-shallow.production.min.js0.0%0.0%11.8 KB11.8 KB3.68 KB3.68 KBNODE_PROD
react-test-renderer.development.js+0.1%+0.1%571.35 KB571.85 KB123.23 KB123.36 KBUMD_DEV
react-test-renderer.production.min.js🔺+0.1%🔺+0.1%68.6 KB68.68 KB21.06 KB21.09 KBUMD_PROD
react-test-renderer.development.js+0.1%+0.1%566.89 KB567.39 KB122.08 KB122.22 KBNODE_DEV
react-test-renderer.production.min.js🔺+0.1%🔺+0.1%68.32 KB68.4 KB20.82 KB20.84 KBNODE_PROD

react-reconciler

FileFilesize DiffGzip DiffPrev SizeCurrent SizePrev GzipCurrent GzipENV
react-reconciler.development.js+0.1%+0.1%557.2 KB557.7 KB119.08 KB119.21 KBNODE_DEV
react-reconciler.production.min.js🔺+0.1%🔺+0.1%68.5 KB68.58 KB20.42 KB20.44 KBNODE_PROD
react-reconciler-reflection.development.js0.0%0.0%18.66 KB18.66 KB6.03 KB6.03 KBNODE_DEV
react-reconciler-reflection.production.min.js0.0%🔺+0.3%2.58 KB2.58 KB1.13 KB1.13 KBNODE_PROD
react-reconciler-persistent.development.js+0.1%+0.1%554.79 KB555.29 KB118.02 KB118.15 KBNODE_DEV
react-reconciler-persistent.production.min.js🔺+0.1%🔺+0.1%68.51 KB68.59 KB20.42 KB20.45 KBNODE_PROD

Generated by 🚫 dangerJS

@sebmarkbage
sebmarkbage merged commit b4178af into react:masterJul 18, 2019
@sebmarkbage

Copy link
Copy Markdown
Contributor

Thanks @paulshen! Sorry about the long back and forth.

@gaearon

Copy link
Copy Markdown
Collaborator

We've published 0.0.0-db3ae32b8 of all packages, which includes this fix. It is likely to be a release candidate for 16.9.0. You can give it a try now and see whether it resolves the issue for you. Thanks.

@jonnycornwell

Copy link
Copy Markdown

👍 Thanks guys, finally got around to retesting and this definitely fixes the leak in the gatsby starter I made

@gaearon

Copy link
Copy Markdown
Collaborator

16.9 is out too.

This was referenced Mar 10, 2020
@sebmarkbagesebmarkbage mentioned this pull request May 4, 2020
6 tasks
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@paulshen@sizebot@sebmarkbage@gaearon@jonnycornwell@facebook-github-bot