Skip to content

Commit 0c4c017

Browse files
committed
fix: FunctionWrapper isolate-level leak
1 parent 157dda7 commit 0c4c017

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

NativeScript/runtime/MetadataBuilder.mm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@
9797
tns::SetValue(isolate, func, new FunctionWrapper(funcMeta));
9898
MetadataBuilder::DefineFunctionLengthProperty(context, funcMeta->encodings(), func);
9999

100-
cache->CFunctions.emplace(funcName, std::make_unique<Persistent<v8::Function>>(isolate, func));
100+
auto uniquePersistent = std::make_unique<Persistent<v8::Function>>(isolate, func);
101+
uniquePersistent->SetWrapperClassId(Constants::ClassTypes::DataWrapper);
102+
cache->CFunctions.emplace(funcName, std::move(uniquePersistent));
101103

102104
info.GetReturnValue().Set(func);
103105
} else if (meta->type() == MetaType::Var) {

0 commit comments

Comments
 (0)