model-viewer icon indicating copy to clipboard operation
model-viewer copied to clipboard

How to properly clear or reset <model-viewer> variants to avoid memory issues on mobile?

Open Comerick opened this issue 6 months ago • 0 comments

Hi team,

I'm experiencing a memory-related issue when working with on mobile devices. After switching between variants (e.g., using the variantName attribute), the memory usage increases significantly. Eventually, it seems like variant data is being cached or retained, causing performance degradation and even crashes on lower-end devices.

This typically happens when:

I load only a single GLB file into instance using the src attribute.

I use KHR_materials_variants.

After switching between variants several times, performance becomes noticeably worse on mobile and website crashes.

Question: Is there a proper way to:

Clear out or "reset" the variants metadata and internal references when switching models?

Any suggestions or recommended practices for this scenario would be greatly appreciated.

Thanks in advance for your support and awesome work on this project!

Example:

https://onsite-scripter.holostep.io/serve/embedded.html?accountId=45&sceneId=685faac1d90bf1877c600951

Comerick avatar Jun 28 '25 18:06 Comerick