emscripten-core/emscripten

WebIDL binder: Use WeakRefs in cache

Open

#9,854 建立於 2019年11月18日

在 GitHub 查看
 (7 留言) (2 反應) (0 負責人)C++ (3,519 fork)batch import
good first bughelp wanted

倉庫指標

Star
 (27,361 star)
PR 合併指標
 (平均合併 19天 10小時) (30 天內合併 147 個 PR)

描述

The cache maps C pointers (integers) to JS object wrappers. It currently keeps objects alive forever. This is normally ok as the objects should be manually destroy()ed, however, we do allow wrapping a class as a parent class, and then it ends up in multiple caches, see https://github.com/kripken/ammo.js/issues/284

Using WeakRefs where available could avoid this. However, until they are present everywhere, perhaps we could analyze the inheritance graph and clean up parent caches too, but that may be tricky especially with multiple/virtual/etc. inheritance.

貢獻者指南