[webkit-dev] DO NOT USE JSC::Strong in WebCore

Ryosuke Niwa rniwa at apple.com
Thu Jun 27 16:08:47 PDT 2024


Please don’t use `JSC::Strong` in WebCore. Such a code often leads to memory leaks, and it’s almost always wrong.

Often times, the correct solution is to use `JSC::Weak` and either visit children or opaque roots to keep it alive:
https://docs.webkit.org/Deep%20Dive/Architecture/JSWrappers.html#opaque-roots
If you’re not sure or don’t know how to use them correctly, come talk to me or anyone else familiar with JS DOM bindings.

Reviewers, please don’t r+ a patch which uses JSC::Strong unless you’re absolutely confident that it does not lead to a memory leak. The vast majority of PRs that use JSC::Strong should be outright r-'ed.

- R. Niwa

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20240627/5fb61d33/attachment.htm>


More information about the webkit-dev mailing list