You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(core): clear up integrations on dispose (#20407)
closes#19573
closes
[JS-1829](https://linear.app/getsentry/issue/JS-1829/investigate-in-memory-leak-within-console-integrations-on-cloudflare)
As with Cloudflare we create a new client on every request, that means
that every integration that uses an `addHandler` and is used by the
Cloudflare SDK is makes the client not disposable - so the garbage
collector can't remove it properly.
This PR adds a callback for `addHandler` that basically removes the
handler from the global handler array (for now only for integrations,
which are used by the Cloudflare SDK). I actually also tried to change
the global handler to be a `WeakMap`, but it still showed some memory
leaks with that, so we need to actively remove these callbacks.
For now, to not increase the bundle sizes for core too much, it is
actually removing the handlers only in the `ServerRuntimeClient`, as for
browsers it is usually not really an issue.
0 commit comments