Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
D.CODE

Memory leak in Scrolltrigger scrub

Go to solution Solved by GreenSock,

Recommended Posts

Hi, guys

In my Vue project, Scrolltrigger make huge memory leak.

How can I fix it?

 

 

 

1. No memory leak(scrub 0)
Detached HTML nodes -> GC

Group.png.786c546d98c4e917ffefd4e0abf60425.png

 

 

 

 

 

2. Memory leak(scrub greater than 0)
Detached HTML nodes -> No GC

732619238_Group2.png.4d96608dfa5898dd5593487a6a39ca4f.png

 

 

 

Link to comment
Share on other sites

It's very difficult to troubleshoot blind but I think this has nothing to do with ScrollTrigger - the scrub doesn't add any DOM nodes at all. I imagine this has more to do with the framework you're using and it not releasing things if they're still being animated or something like that. 

 

Can you please provide a minimal demo that clearly illustrates the issue? 

  • Thanks 1
Link to comment
Share on other sites

@GreenSock

 

Thanks for your comment. I think, scrubbed tween has a object reference still and It makes no memory release for Detached Nodes(it was tween target). 

Sorry for that I'm not friendly with codepen. And minimal demo required vuejs + router. I will find solution. But I can't be sure.

Link to comment
Share on other sites

You can use codesandbox for Vue.

 

But doesn't it take a couple minutes for the GC to catch up?

  • Thanks 1
Link to comment
Share on other sites

@OSUblake

 

In the video, as you can see, I forced GC(as  clicking  the  trash can icon it immediately activates GC)

 

your mention for codesandbox, It so helpful for me. I will make that.

Link to comment
Share on other sites

Interesting. I'm seeing with the same issue with 0. Looks like GSAP's cache isn't being cleared. Stand by while we look into this.

 

image.png

 

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • Solution

I see the issue - it's due to the fact that the scrub tween is paused but not killed inside the ScrollTrigger's kill() method. I've patched that in the next release, but for now you can accomplish the same thing by doing this to kill everything:

gsap.killTweensOf(tl);
tl.scrollTrigger.kill();
tl.kill();

Does that resolve things for you? 

 

I'd also recommend updating to 3.7.1. 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

@GreenSock @OSUblake

 

It works perfectly 💯. So much appreciate!! You guys my lifesaver.

 

PS: I used gsap 3.7.X but Scrolltrigger got some bugs. So I downgrade...
Can you please recommend Scrolltrigger version for gsap 3.7.1?

Link to comment
Share on other sites

10 hours ago, D.CODE said:

PS: I used gsap 3.7.X but Scrolltrigger got some bugs. So I downgrade...

I'm very curious about this - can you please elaborate? We're not aware of any other bugs at this point. Can you provide a minimal demo that shows what you think is a bug? 

 

10 hours ago, D.CODE said:

Can you please recommend Scrolltrigger version for gsap 3.7.1?

I don't understand the question. I was recommending 3.7.1 (GSAP and ScrollTrigger)

  • Like 1
Link to comment
Share on other sites

9 hours ago, GreenSock said:

I don't understand the question. I was recommending 3.7.1 (GSAP and ScrollTrigger)

I didn't know they were the same version. I will try. Thank you 🙋‍♂️

 

 

9 hours ago, GreenSock said:

I'm very curious about this - can you please elaborate? We're not aware of any other bugs at this point. Can you provide a minimal demo that shows what you think is a bug? 

Sorry, I can't make that bug intentionally. That was made Scrolltrigger wrong start point. Later, If I had some bug, I will make demo and share you.
(Sorry my english. I'm not good, so I can't tell you detailedly.)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×