mirror of
https://github.com/ChromeDevTools/chrome-devtools-mcp.git
synced 2026-09-14 19:45:30 +08:00
d05cbc0511
## Rationale DevTools' `TraceEngine.TraceModel.Model` permanently retains parsed traces in an internal recordings array (`#traces`). Calling `engine.resetProcessor()` between runs only resets the underlying processor and does not clear `#traces`. Because `engine` was previously instantiated as a module-scoped singleton, every performance trace recorded or parsed in a session remained permanently held in heap memory for the lifetime of the process. ## Changes - In `src/processors/PerformanceTrace.ts`, instantiate `DevTools.TraceEngine.TraceModel.Model.createWithAllHandlers()` per invocation of `parseRawTraceBuffer()`. - Remove the module-scoped `engine` singleton and the obsolete `engine.resetProcessor()` call. - Add a unit test in `tests/trace-processing/parse.test.ts` verifying that consecutive trace parses construct isolated `Model` instances and keep internal trace retention bounded at 1. - Add a profiling regression scenario in `scripts/profile/scenarios/performance_trace.ts` to guard against memory retention across consecutive traces during `npm run test:memory`.