Discovered while writing characterization tests for projects/spikersoft/src/app/_components/_games/space-game/spacecraft/thruster-instance-manager.ts (wave 7 coverage).
What happens
registerSpacecraft advances nextInstanceIndex by the thruster count. unregisterSpacecraft hides those instances (scale-0 matrix + zeroed thrusterStates) and deletes the registration, but does not decrement nextInstanceIndex or recycle the freed range.
A spacecraft that despawns and respawns therefore consumes a new block of the 24×N InstancedMesh pool. After enough spawn/despawn cycles the manager hits Out of instance capacity even though no live spacecraft occupy the earlier slots.
Repro (characterization, already pinned)
getInstance(1) → 24 slots.
registerSpacecraft(1, …) → indices [0].
unregisterSpacecraft(1).
registerSpacecraft(1, …) again → indices [1], not [0].
Expected
Unregister should return the range to a free list (or compact nextInstanceIndex) so a re-register reuses the old indices.
Pinned as a characterization test in thruster-instance-manager.spec.ts so the suite stays green until this is fixed.
Discovered while writing characterization tests for `projects/spikersoft/src/app/_components/_games/space-game/spacecraft/thruster-instance-manager.ts` (wave 7 coverage).
## What happens
`registerSpacecraft` advances `nextInstanceIndex` by the thruster count. `unregisterSpacecraft` hides those instances (scale-0 matrix + zeroed `thrusterStates`) and deletes the registration, but **does not decrement `nextInstanceIndex` or recycle the freed range**.
A spacecraft that despawns and respawns therefore consumes a *new* block of the 24×N InstancedMesh pool. After enough spawn/despawn cycles the manager hits `Out of instance capacity` even though no live spacecraft occupy the earlier slots.
## Repro (characterization, already pinned)
1. `getInstance(1)` → 24 slots.
2. `registerSpacecraft(1, …)` → indices `[0]`.
3. `unregisterSpacecraft(1)`.
4. `registerSpacecraft(1, …)` again → indices `[1]`, not `[0]`.
## Expected
Unregister should return the range to a free list (or compact `nextInstanceIndex`) so a re-register reuses the old indices.
Pinned as a characterization test in `thruster-instance-manager.spec.ts` so the suite stays green until this is fixed.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Discovered while writing characterization tests for
projects/spikersoft/src/app/_components/_games/space-game/spacecraft/thruster-instance-manager.ts(wave 7 coverage).What happens
registerSpacecraftadvancesnextInstanceIndexby the thruster count.unregisterSpacecrafthides those instances (scale-0 matrix + zeroedthrusterStates) and deletes the registration, but does not decrementnextInstanceIndexor recycle the freed range.A spacecraft that despawns and respawns therefore consumes a new block of the 24×N InstancedMesh pool. After enough spawn/despawn cycles the manager hits
Out of instance capacityeven though no live spacecraft occupy the earlier slots.Repro (characterization, already pinned)
getInstance(1)→ 24 slots.registerSpacecraft(1, …)→ indices[0].unregisterSpacecraft(1).registerSpacecraft(1, …)again → indices[1], not[0].Expected
Unregister should return the range to a free list (or compact
nextInstanceIndex) so a re-register reuses the old indices.Pinned as a characterization test in
thruster-instance-manager.spec.tsso the suite stays green until this is fixed.Fixed in
spikersoft-angularPR #823 (a0f0ccd9). Closing.