Skip to content

GPU memory leakage #2030

@WojciechCendrzak

Description

@WojciechCendrzak

Before you start - checklist

  • I followed instructions in documentation written for my React-PDF version
  • I have checked if this bug is not already reported.
  • I have checked if an issue is not listed in Known issues
  • If I have a problem with PDF rendering, I checked if my PDF renders properly in PDF.js demo

Description

Thank you for this great react-pdf work!

In the project I am working on, I have to mount/unmount pages quite often and just discovered a GPU memory leak.

When unmounting the Page component, the amount of GPU memory (Chrome Task Manager) remains at the previous level.

Steps to reproduce

Run app locally, see this repo
or
vercel build here

  • Open Chrome task Manager (show GPU Memory column)
  • GPU Memory should be ~ 1 MB
  • Press Show pdf button. GPU Memory should jump to ~ 590 MB
  • Press Hide pdf button.
  • Wait 5-10 sec for garbage colector

Expected behavior

  • GPU Memory usage should drop back to ~ 2 MB

Actual behavior

  • GPU Memory usage remain at same high level ~ 590 MB

Additional information

  • React strict mode was switched off to not affect memory
  • Hot reloading was switched off to not affect memory
  • Newest versions of packages were used (vite, react, react-pdf)
  • High Device Pixel Rate (10) was used to amplify an effect

Screenshoots

Image Image

Environment

  • Browser (if applicable): Chrome 141
  • React-PDF version: react-pdf (10.2.0)
  • React version: react (19.2.0)
  • Bundler name and version (if applicable): vite (7.1.12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions