Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebSG - disposal leak upon certain script errors #605

Open
NateTheGreatt opened this issue May 4, 2023 · 0 comments
Open

WebSG - disposal leak upon certain script errors #605

NateTheGreatt opened this issue May 4, 2023 · 0 comments

Comments

@NateTheGreatt
Copy link
Contributor

NateTheGreatt commented May 4, 2023

reproducing script:

world.onenter = () => {
  const scene = world.environment;

  const boxNode = world.createNode({
    mesh: world.createBoxMesh({
      size: [1, 1, 1],
      segments: [1, 1, 1],
      material: world.createMaterial({
        baseColorFactor: [1, 1, 1, 1],
      }),
    }),
    collider: world.createCollider({ type: "box", size: [1, 1, 1] }),
  });
  
  boxNode.addPhysicsBody({ type: WebSG.PhysicsBodyType.Kinematic });

  // cause the script to error out before the node is added to the scene 
  boxNode.notAFunction();
  
  scene.addNode(boxNode);
};

By causing the script to error out before the node is added to the scene, a detached physics body is created that never gets disposed of, even when switching worlds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant