Skip to content

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

@Comerick

Description

@Comerick

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions