donmccurdy / glTF-Transform

glTF 2.0 SDK for JavaScript and TypeScript, on Web and Node.js.
https://gltf-transform.dev
MIT License
1.3k stars 145 forks source link

Join command runs out of memory #1317

Closed thecatontheflat closed 3 months ago

thecatontheflat commented 3 months ago

Describe the bug After eating 31GB of RAM the process gets OOM-killed

To Reproduce Steps to reproduce the behavior:

  1. Install v4 alpha

    npm install --global @gltf-transform/cli@next @gltf-transform/core@next @gltf-transform/extensions@next @gltf-transform/functions@next
  2. Download the attached GLTF (700MB unpacked) https://www.dropbox.com/scl/fi/q1uisxtqoe7hj4d5gzm1r/world.zip?rlkey=1gt9q5t4ns9v8xwwx8gy6geo2&dl=0

  3. Run the following command to join meshes

    gltf-transform join world.gltf world-transformed.glb
  4. OOM Killed 💀

Versions:

donmccurdy commented 3 months ago

Thanks for the report, @thecatontheflat! I think this issue has the same root cause as #1315, so I'm going to merge the two issues. I've copied over some details from this report as well. If you need a workaround in the meantime, I found that running weld first, followed by join, will complete. The weld step is still slow (also tracked by the issue above), but keeps a more reasonable memory footprint for a file this size.

thecatontheflat commented 3 months ago

The workaround has worked! Thanks for the suggestion!