emscripten-core/emscripten

WebIDL binder: Use WeakRefs in cache

Open

#9.854 geöffnet am 18. Nov. 2019

Auf GitHub ansehen
 (7 Kommentare) (2 Reaktionen) (0 zugewiesene Personen)C++ (3.519 Forks)batch import
good first bughelp wanted

Repository-Metriken

Stars
 (27.361 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 19T 10h) (147 gemergte PRs in 30 T)

Beschreibung

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.

Contributor Guide