Skip to content

Commit b8d6ef3

Browse files
Memory Leak due to JSStringRelease not called in multiple places in JSCRuntime.cpp (#25884)
Summary: Memory Leak due to JSStringRelease not called in multiple places in JSCRuntime.cpp Issue: #25664 Reproducible repo: https://github.com/bhandarijiwan/memory_issue_repro ## Changelog [JSC] [JSCRuntime.cpp] - Added missing JSStringRelease calls in missing places Pull Request resolved: #25884 Test Plan: Tested that is no memory leak with various NativeModule to JS call flows Reviewed By: JoshuaGross Differential Revision: D16928985 Pulled By: TheSavior fbshipit-source-id: 65ce15ae32482d0db39bad7e22a2fed9ee04f230
1 parent b26acae commit b8d6ef3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ReactCommon/jsi/JSCRuntime.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,9 @@ jsi::String JSCRuntime::createStringFromUtf8(
630630
size_t length) {
631631
std::string tmp(reinterpret_cast<const char*>(str), length);
632632
JSStringRef stringRef = JSStringCreateWithUTF8CString(tmp.c_str());
633-
return createString(stringRef);
633+
auto result = createString(stringRef);
634+
JSStringRelease(stringRef);
635+
return result;
634636
}
635637

636638
std::string JSCRuntime::utf8(const jsi::String& str) {

0 commit comments

Comments
 (0)