updateTexture() issue

I am going to use updateTexture() function to change the texture of a 3D model.
But it sometimes returns a failure. How can I fix it?

Here is my code.

api.updateTexture(texturePath, uid, function(err, textureUid) {
        if(!err) {
          console.log('Replaced texture with UID', textureUid);
          Configurator.textureUids.updated++;
        } else {
          console.log(err) // err = 'failed to add texture'
        }
      });

could you provide a minimal sample reproducing the issue ?
a codepen or a jsfiddle would help a lot
(the one in viewer api documentation are forkable and should ease creating one Viewer API - Examples - Sketchfab )

http://pearldrumsdev.prod.acquia-sites.com/en/homepage
You can see the error at the bottom of this page. When selecting a texture, it works for several times, but it returns a failure message in the updateTexture() function.

It may just be a javascript memory problem because texture are huge memory data users:

  • try to update less frequently or let JS GC to collect memory (check chrome task manager)
  • try with embed option “material_packing: 0”

Thank you for your response. I know it is a javascript memory problem. But isn’t Sketchfab capable of switching more than 10 textures at a time?
Could you please tell me how to fix it? (with some code?)

Could you please tell me how to fix it?

Did you try the 2 solution in my previous post ?