Skip to content
This repository was archived by the owner on Apr 13, 2023. It is now read-only.
This repository was archived by the owner on Apr 13, 2023. It is now read-only.

Memory leak in renderToStringWithData #2126

@amannn

Description

@amannn

Intended outcome:

I have a service which uses the renderToStringWithData function from react-apollo. I expect the function to not have any memory leaks.

Actual outcome:

The service crashes every now and then, because it runs out of memory. I read a tutorial on how to diagnose memory leaks and I think I found one that is caused by the mentioned function. I have the same issue with another node app which uses renderToStringWithData.

This graph shows the growing memory consumption of my reproduction with GitHunt:

How to reproduce the issue:

  1. Clone https://github.com/amannn/GitHunt-React
  2. Make sure you're on the memory-profiling branch.
  3. Do the regular GitHunt setup.
  4. yarn build
  5. yarn start
  6. ab -n 100 http://127.0.0.1:3000/ (sends a request to the server 100 times)
  7. When the requests are through, stop the server. This will cause the profiling data to be written to stats.json.
  8. Run python plot.py to see the graph.

The mentioned tutorial also outlines a method for getting more information about which objects are allocated and never released by garbage collection.

Version

  • apollo-client@2.3.5
  • react-apollo@2.1.6

Metadata

Metadata

Assignees

Labels

blockingPrevents production or dev due to perf, bug, build error, etc..has-reproduction❤ Has a reproduction in a codesandbox or single minimal repository

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions