What problem does it solve?
WASM objects used by brepjs are not tracked by the JavaScript garbage collector, so un-disposed shape and kernel handles cause silent, growing memory leaks that can crash browser-based CAD applications without warning.
Core Features & Use Cases
- Deterministic Handle Cleanup: Guides use of the
using keyword, DisposalScope, and scoped helper functions to ensure all WASM handles are freed predictably at the end of their lifetime.
- Leak Detection Workflow: Provides step-by-step instructions for using
getDisposalStats to identify missing disposal calls, peak handle accumulation, and FinalizationRegistry-reclaimed handles.
- Kernel-Specific Guidance: Explains the critical difference between occt-wasm arena memory (freed only via kernel dispose calls) and Embind kernel memory (freed directly via handle delete) to debug leaks that only appear on one kernel.
- Use Case: Use this skill when writing new brepjs *Fns.ts operations, debugging unexplained memory growth in the browser playground, or enforcing the
require-using-for-handles pattern checker rule in CI.
Quick Start
Use the memory-and-disposal skill to audit your new brepjs operation code for missing handle disposal calls and fix any WASM memory leak risks.