Skip to content

Dispose temporary STEP conversion resources#911

Open
cwklurks wants to merge 3 commits into
tscircuit:mainfrom
cwklurks:codex-step-conversion-dispose-temp-group
Open

Dispose temporary STEP conversion resources#911
cwklurks wants to merge 3 commits into
tscircuit:mainfrom
cwklurks:codex-step-conversion-dispose-temp-group

Conversation

@cwklurks
Copy link
Copy Markdown

Summary:

  • Dispose the temporary OCCT-generated Three.js group after STEP-to-GLB export completes or fails.
  • Free conversion-only geometries and materials immediately instead of retaining them until GC.
  • Leave the existing GLB/localStorage/blob cache behavior unchanged.

/claim #93

Checks:

  • bun -e 'import * as THREE from "three"; import { disposeStepConversionResources } from "./src/utils/dispose-step-conversion-resources"; const group = new THREE.Group(); const geometry = new THREE.BufferGeometry(); const material = new THREE.MeshStandardMaterial(); let geometryDisposed = 0; let materialDisposed = 0; geometry.dispose = () => { geometryDisposed += 1 }; material.dispose = () => { materialDisposed += 1 }; group.add(new THREE.Mesh(geometry, material)); disposeStepConversionResources(group); if (geometryDisposed !== 1 || materialDisposed !== 1) throw new Error(dispose failed: ${geometryDisposed}/${materialDisposed}); console.log("dispose smoke passed")'
  • bunx biome check src/three-components/StepModel.tsx src/utils/dispose-step-conversion-resources.ts

Note: bun run build completed the ESM bundle locally, then stalled in DTS generation for several minutes, so I stopped it.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 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 23, 2026 5:49pm

Request Review

@cwklurks
Copy link
Copy Markdown
Author

Follow-up after an adversarial review pass: I added a focused regression test for the owned STEP conversion disposal helper, covering both single-material and material-array meshes. Scope note: this PR is intentionally the narrow STEP conversion resource-cleanup slice, not a global loader/cache rewrite.

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