cssinjs / cssinjs/jss

[react-jss] Memory leak from CSS transforms

Open
#801 5 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
7.1k
Forks
386
PR merge metrics
No merged PRs in 30d

Description

_From @josh-stevens on June 1, 2018 19:29_

Hi,

So I'm doing a long running animation using CSS transforms. It's a digital signage application so this is something that runs for hours on end. After about 12 hours or so, the application was eating 2.5GB of memory.

I did some profiling and it looks like JSS is the culprit. Here's a picture of what it's holding onto after 5 minutes.

screen shot 2018-06-01 at 2 00 35 pm

There are only 8 objects with their styles being updated. It updates the props every animation frame so about 60 times per second. Once those styles have been applied for their frame, they aren't needed anymore and should be discarded/gc'd. But as shown in the screenshot, I'm looking at Snapshot 6 (taken 5 minutes after Snapshot 1) and it's holding on to all those strings allocated between Snapshot 1 and Snapshot 2.

If I remove JSS from the equation and do the transform as an inline style, the snapshots don't blow up the way they do here. That's a fine workaround for my purposes, but thought I would at least raise the issue here. Why is JSS holding onto all the strings it creates?

_Copied from original issue: cssinjs/react-jss#253_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.