Memory leak when loading Rive animation on page navigation

Hi everyone,

I’m running into a memory leak issue with Rive animations in my project.

  • We’re using @rive-app/webgl2 version ^2.31.2.

  • The frontend framework is Qwik.

Here’s the problem:

  • Every time I navigate to the page that contains my Rive animation, memory usage (checked in the Memory tab of Chrome DevTools) increases by at least 200MB.

  • This increase is cumulative — if I leave the page and come back multiple times, the memory usage keeps going up by another ~200MB each time.

  • I expected that when leaving the page, the allocated memory would either be released, or at least reused when I load the animation again. But instead, it just keeps growing.

  • I’ve already tried calling cleanup(). This does clear the visual animation, but the memory usage does not go down.

It looks like some references/resources are not being freed when the animation or canvas is destroyed.

Has anyone else experienced this issue with @rive-app/webgl2? Is there a recommended way to fully dispose of a Rive animation so memory is properly released when navigating between pages in Qwik?

Thanks in advance!