Skip to content

Commit 6bd3ba9

Browse files
authored
Merge pull request #1566 from FrancisDuvivierTHEO/master
Clean up allocations from finalized object links
2 parents 7eeb181 + ea37f3f commit 6bd3ba9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test-app/runtime/src/main/cpp/ObjectManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ void ObjectManager::JSObjectFinalizer(Isolate *isolate, ObjectWeakCallbackState
325325

326326
if (jsInstanceInfo == nullptr) {
327327
po->Reset();
328+
delete po;
329+
delete callbackState;
328330
return;
329331
}
330332

@@ -341,6 +343,9 @@ void ObjectManager::JSObjectFinalizer(Isolate *isolate, ObjectWeakCallbackState
341343
auto jsInfoIdx = static_cast<int>(MetadataNodeKeys::JsInfo);
342344
po->Get(m_isolate)->SetInternalField(jsInfoIdx, Undefined(m_isolate));
343345
po->Reset();
346+
m_idToObject.erase(javaObjectID);
347+
delete po;
348+
delete callbackState;
344349
}
345350
}
346351

0 commit comments

Comments
 (0)