Skip to content

Garbage collecting objects that are generated every frame #1010

Closed
@asajeffrey

Description

@asajeffrey

The webxr API generates some objects every frame, e.g. the frame and pose objects, which needs the GC to be able to efficiently free them. This is straightforward in a generational GC, we just hint to the GC to run a minor GC at the end of each rAF. The problem is that any per-frame objects that are still live at the end of the rAF will be tenured, so after enough rAFs there will be a major GC, which causes frame rates to drop while it's running. The worst-case scenario for this is if user code keeps access to some of the previous frame's objects, e.g. keep a pointer to last frame's pose data. Then each minor GC will cause an object to be tenured.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions