Release PerfMetricsBinding to avoid memory leak (#53420)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53420

# Changelog: [Internal]

HostRuntimeBinding owns a connection, which is stored as a session on HostTarget, so we need to release it first in order to satifsy the assertion in the destructor.

Reviewed By: huntie

Differential Revision: D80778273

fbshipit-source-id: be7bf085fadd8808fd5e5c621c3990a5e7e0186d
This commit is contained in:
Ruslan Lesiutin
2025-08-22 05:07:02 -07:00
committed by Facebook GitHub Bot
parent 8d8245123e
commit 4b34be445d
@@ -220,6 +220,11 @@ HostTarget::~HostTarget() {
// HostCommandSender owns a session, so we must release it for the assertion
// below to be valid.
commandSender_.reset();
// HostRuntimeBinding owns a connection, so we must release it for the
// assertion
perfMetricsBinding_.reset();
// Sessions are owned by InspectorPackagerConnection, not by HostTarget, but
// they hold a HostTarget& that we must guarantee is valid.
assert(