fix(ecs): the WASM registry and Entity handles are never freed

オープン
#492 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript, wasm
領域
backend

調査の方向性

Read modules/ecs/src/shared/ecs-library.ts and modules/ecs/src/shared/editor-world.ts at the linked lines, then inspect the Registry cleanup methods in modules/ecs/wasm/Registry.hpp. Trace how __init, clear_entities, and the editor tracker manage handles; done means systems, entities, and the registry are released when the library or tracker is cleared. No test file is named in the issue.

索引モデルが issue の本文から書いたものです。

説明

bug modules:ecs
Which package is this bug report for?

ecs

Issue description

EcsLibrary has no __clear and never delete()s its Registry, which holds every component and system through embind handles; each __init instantiates a new WASM module. The editor tracker keeps the Entity handles returned by spawnEntity and never .delete()s them. clear_entities leaves _systems in place. Memory grows with every editor restart and every spawn in live mode.

Where:

Evidence:

this._module = await this.loadModule({ locateFile: () => wasmUrl });
this._registry = new this._module.Registry();
...
entities.set(entity.getId(), { entity, ... });

Suggested fix: Add a __clear that clears systems and entities, calls registry.delete() and drops the reference. Call entity.delete() when the tracker drops an entity.

Found during a code audit of main at be72076.

Code sample

No response

Versions
  • Engine main at be72076
  • pnpm 12.0.0, Node.js 26, Bun 1.3.14
Issue priority

Medium (should be fixed soon)

I have tested this issue on a development release

be72076

主要言語
TypeScript
スター
7
フォーク
2
平均マージ
1日 17時間
マージ済み PR(30日)
17

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

NanoForge-dev/Engine のほかの issue

NanoForge-dev/Engine の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。