Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leaks Chrome? #92

Open
Geddo opened this issue Aug 25, 2023 · 0 comments
Open

Memory Leaks Chrome? #92

Geddo opened this issue Aug 25, 2023 · 0 comments

Comments

@Geddo
Copy link

Geddo commented Aug 25, 2023

First: Awesome tool. Super useful and well documentated. Keep up the good work.

My current problem:
After creating and destroying multiple spritespins, I have many "Detached HTMLImageElements" which are not getting garbage collected

Example ("spritespin": "@beta"):

let spriteSpinInstance = null;
let images = null;
let frames = null;
window.getSpriteSpinInstances = function () {
  return spriteSpinInstance;
};
export function initTurntable() {
  
    images = $("#turntable").attr("data-images");

    frames = SpriteSpin.source(images, 
        {frame: [1, 719], digits: 3});

    spriteSpinInstance  = SpriteSpin.create({
      target: '#turntable',
      source: frames,
      width: 2160,
      height: 2160,
      animate: false,
      detectSubsampling: false,
      frames: 719,
      retainAnimate: false,
      sense: -1,
      plugins: [
          'drag',
          'ease',
          '360'
      ]     
    })
}
export function destroyTurntable() {  
    if($("#turntable").lenth) {     
      SpriteSpin.destroy("#turntable");   
    }
    if (spriteSpinInstance !== null) {        
        spriteSpinInstance.destroy();     
    }
    spriteSpinInstance = null;
}

After destroyTurntable I also remove the div where the turntable was set. Besides the "Detached HTMLImageElements" I also have many Arrays and Object leftovers from previews turntables so it seems that "destroy" not really removing all Eventhandlers and stuff from the turntables.

Am I missing something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant