Skip to content

[Bug]: ThemeProvider memory leak while using on page using SSR #32438

@mahish

Description

@mahish

Library

React / v8 (@fluentui/react)

System Info

System:
    OS: macOS 14.6.1
    CPU: (8) arm64 Apple M1 Pro
    Memory: 1.06 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Browsers:
    Chrome: 128.0.6613.86
    Safari: 17.6

Are you reporting an Accessibility issue?

None

Reproduction

https://stackblitz.com/edit/stackblitz-starters-w5tjge?file=README.md

Bug Description

Actual Behavior

Each server request increases memory usage of useThemeProviderClasses without freeing it.

image

The following screenshot was taken while running the same sample without <ThemeProvider>:

image

The first snapshot was taken after fresh server start. The other ones after load test of 25 requests per second for ~50s. Garbage collector triggered before each snapshot.

I followed this guide https://alberic.trancart.net/2020/05/how-fixed-first-memory-leak-nextjs-nodejs/

Expected Behavior

The memory after triggering garbage collector should stay circa the same

Logs

No response

Requested priority

High

Products/sites affected

No response

Are you willing to submit a PR to fix?

no

Validations

  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.

Metadata

Metadata

Labels

Area: SSRServer-side renderingFluent UI react (v8)Issues about @fluentui/react (v8)Resolution: Soft CloseSoft closing inactive issues over a certain period

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions