mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 00:23:14 +00:00
6f24133d35
getObjects() is on every real host page's path — a click hands back an object id, and resolving it to a GlobalId/name/type needs the element tables (the JS layer also builds its GUID index from this call). The implementation materialised a vector of ElementRef (three fresh std::strings per element), serialised the entire scene into one JSON string grown by +=, and UTF8ToString'd the whole thing — several hundred MB simultaneously alive at ~600k elements. The wasm heap never returns pages, so that transient became the session's permanent floor. ViewportCore::visitModelElements hands out one model's elements as slices into its string table (no per-element copies), and the export serialises straight from those, one model per batch, reusing one string whose capacity grows only to the largest model. The JS side accumulates batches and resolves the same array as before — the page API is unchanged. Peak is now one model's JSON instead of the scene's. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>