| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
V8 weak callbacks enqueue N-API finalizers for a safe second pass, but AppRuntime did not drain that queue. Run the queue after each host dispatch and cover the behavior with a deterministic V8-only unit test.
| napi_env env_ptr{env}; | ||
|
|
||
| // Finalizers can mutate this queue, so continue until it is empty. | ||
| while (!env_ptr->pending_finalizers.empty()) |
There was a problem hiding this comment.
hypothetically, this could go on forever in some pathological case with a semi-malicious native module. lmk if you want a safeguard counter check in there.
Sorry, something went wrong.
Run deferred V8 finalizers once after each dispatcher batch and cap each batch at eight milliseconds. This prevents large GC queues from monopolizing the runtime thread while preserving eventual finalization on later turns. Add a deterministic slow-finalizer regression test that proves the queue yields and then drains completely.
| Back | FazBrowse Home | New Git URL |
Summary
Drain deferred V8 N-API finalizers at a safe host boundary, with an 8 ms budget per dispatcher turn.
V8 weak callbacks enqueue non-experimental N-API finalizers for a safe second pass. JsRuntimeHost did not run that pass, so collected wrappers retained native resources until runtime teardown. This is independent of Dawn, WebGPU, and application rendering code.
Reproduction
The profiling workload uses four packaged VRM files (from https://github.com/PolygonalMind/100Avatars ), loaded through the browser-shaped Blob path, with four thin instances per avatar. It replaces the batch ten times after 180 rendered frames:
The measured files were four distinct 6-10 MB VRMs from PolygonalMind/100Avatars.
Validation