Skip to content

Dispose temporary STEP export resources#906

Open
zergzorg wants to merge 3 commits into
tscircuit:mainfrom
zergzorg:codex/dispose-step-export-resources-93
Open

Dispose temporary STEP export resources#906
zergzorg wants to merge 3 commits into
tscircuit:mainfrom
zergzorg:codex/dispose-step-export-resources-93

Conversation

@zergzorg
Copy link
Copy Markdown

@zergzorg zergzorg commented May 20, 2026

/claim #93

Summary

  • dispose the temporary STEP conversion group after GLTFExporter succeeds or fails
  • dispose mesh geometries, materials, and common/newer material texture slots via a shared helper
  • add coverage for single-material, multi-material, and MeshPhysicalMaterial texture disposal paths

Effect

The STEP conversion path builds an intermediate THREE.Group only to export a GLB buffer. Before this change, those temporary BufferGeometry, Material, and Texture objects stayed undisposed after export, so repeated STEP loads could keep GPU-side resources around longer than needed. The GLB cache and rendered model behavior are unchanged.

Scope and non-overlap

This PR is a cleanup/resource-disposal slice for temporary STEP export resources. It complements cache-focused work on issue #93: cache changes reduce repeated loading, while this PR makes sure the intermediate Three.js resources created during STEP export are released whether export succeeds or fails.

Validation

  • bun test tests/dispose-object3d-resources.test.ts
  • bun run build
  • bunx biome format src/utils/dispose-object3d-resources.ts src/three-components/StepModel.tsx tests/dispose-object3d-resources.test.ts
  • git diff --check

Issue: #93

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
3d-viewer Ready Ready Preview, Comment May 24, 2026 3:15pm

Request Review

Signed-off-by: zergzorg <kaluga@me.com>
@zergzorg
Copy link
Copy Markdown
Author

Follow-up hardening pushed in 20fd21c:

  • expanded the shared disposal helper to cover newer Three.js material texture slots such as clearcoat/transmission/specular/sheen maps
  • added a focused regression test for MeshPhysicalMaterial extension texture disposal

Validation:

  • bun test tests/dispose-object3d-resources.test.ts
  • bunx biome format src/utils/dispose-object3d-resources.ts tests/dispose-object3d-resources.test.ts
  • bunx tsc --noEmit
  • GitHub format-check, test, and type-check are passing on the new head

@zergzorg
Copy link
Copy Markdown
Author

Follow-up hardening pushed in 625cc3f:

  • kept shared envMap textures out of the temporary STEP resource disposer, since environment maps are commonly shared scene assets rather than resources owned by the converted mesh
  • added regression coverage proving the helper still disposes owned geometry/material texture slots while leaving envMap intact

Validation:

  • bun test tests/dispose-object3d-resources.test.ts
  • bunx biome format --write src/utils/dispose-object3d-resources.ts tests/dispose-object3d-resources.test.ts
  • bunx biome check src/utils/dispose-object3d-resources.ts tests/dispose-object3d-resources.test.ts
  • bunx tsc --noEmit
  • bun run build
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant