Threejs unexplained crash "Out of Memory"

the cannon-es.js has memory leak, i hope the cannon will be updated and address the bugs:

  1. memory leak
  2. trimesh and polyhedron bugs
  3. raycast vehicle postStep should be removed when vehicle is removed from world

The cause of the browser crash “out of memory” was not because of threejs or cannon-es, the crash occurred because the function mesh-to-trimesh ( mesh ) is returning undefined.

function mesh-to-trimes ( mesh ) {
  ...
  for ( i = 0 ; i < mesh.lenght ; i ++ ) {
    ...
  }
  return shape
}
shape = mesh-to-trimesh ( mesh )

I fixed the bug by making the function mesh-to-trimesh ( mesh ) an async function and adding await to the call

async function mesh-to-trimes ( mesh ) {
  ...
  for ( i = 0 ; i < mesh.lenght ; i ++ ) {
    ...
  }
  return shape
}
shape = await mesh-to-trimesh ( mesh )