Submission checklist
Description
We are finding instances in our app of dangling references to canvas elements after rive elements have been unmounted. This is causing a growing memory problem that gets worse over time. It's definitely an issue in safari, possibly an issue in chromium based browsers but more difficult to reproduce.
I've created a repo that makes this reproducible - by mounting and un-mounting the rive component about 100 times I end up with two or three extra canvas elements in the memory snapshot. In our actual app with multiple different animations on various routes, we can sometimes see 10s or 100s of canvas elements accruing over time. With large animations this puts a real strain on memory and performance.
https://github.com/melodicdan/rive-memory-leak
Reproduction steps / code
https://github.com/melodicdan/rive-memory-leak
Atached are two heap snapshots, one with the single mounted canvas element and one after re-mounting ~100 times
Upload your reproduction files / stack trace
heap snapshot 1.json
heap snapshot 2.json
Rive React package version
"@rive-app/react-canvas": "^4.33.0",
Source .riv / .rev file
No response
Screenshots / video
No response
Browser & version
Safari 26.0.1
Operating system & version
macOS 15.7.1
Additional context
No response
Submission checklist
@rive-app/react-canvasor@rive-app/react-webgl2(or the renderer variant I'm using)Description
We are finding instances in our app of dangling references to canvas elements after rive elements have been unmounted. This is causing a growing memory problem that gets worse over time. It's definitely an issue in safari, possibly an issue in chromium based browsers but more difficult to reproduce.
I've created a repo that makes this reproducible - by mounting and un-mounting the rive component about 100 times I end up with two or three extra canvas elements in the memory snapshot. In our actual app with multiple different animations on various routes, we can sometimes see 10s or 100s of canvas elements accruing over time. With large animations this puts a real strain on memory and performance.
https://github.com/melodicdan/rive-memory-leak
Reproduction steps / code
https://github.com/melodicdan/rive-memory-leak
Atached are two heap snapshots, one with the single mounted canvas element and one after re-mounting ~100 times
Upload your reproduction files / stack trace
heap snapshot 1.json
heap snapshot 2.json
Rive React package version
"@rive-app/react-canvas": "^4.33.0",
Source
.riv/.revfileNo response
Screenshots / video
No response
Browser & version
Safari 26.0.1
Operating system & version
macOS 15.7.1
Additional context
No response