question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

reading from InMemoryCache causes memory leak (in React Native)

See original GitHub issue

Intended outcome:

Calling readFragment/writeFragment should not increase memory usage at all.

Actual outcome:

Callling readFreagment and then writeFragment repeatedly will increase the memory usage. Calling only readFragment without writeFragment will only increase the memory once, which I guess is some caching to avoid unnecessary reads?

How to reproduce the issue:

I have created a simple app with reproduction: apollo-memory-leak

Versions

  System:
    OS: macOS 11.5.2
  Binaries:
    Node: 14.16.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 6.14.11 - /usr/local/bin/npm
  Browsers:
    Chrome: 94.0.4606.71
    Safari: 15.0
  npmPackages:
    @apollo/client: ^3.4.16 => 3.4.16 

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:8
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

10reactions
oferitzcommented, Oct 13, 2021

Don’t know if it’s the same issue, but I’ve also noticed a possible memory leak regression related to cache after upgrading from 3.4.10 to 3.4.16

Unfortunately I can’t attach the full allocation sampling file as it contains proprietary code but here are some screenshots which might help:

Screen Shot 2021-10-13 at 9 13 58 Screen Shot 2021-10-13 at 9 16 08
1reaction
oferitzcommented, Oct 19, 2021

@brainkim Thanks for update. Sure.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving Memory Leaks with React Native - Enquero
Even when working with memory-managed languages there are cases where memory can be leaked. Leaks are the cause of the whole class of...
Read more >
Advanced topics on caching in Apollo Client
This article describes special cases and considerations when using the Apollo Client cache. Bypassing the cache. Sometimes you shouldn't use the cache for...
Read more >
Memory leak when using Apollo on react native - Stack Overflow
When using ApolloClient in our React NAtive app, we get a memory leak that crashes teh app within 30 seconds of the app...
Read more >
Hunting JS memory leaks in React Native apps
If such a workflow leads to leaking, you should notice your app's memory consumption to grow after you repeat it several times. The...
Read more >
@apollo/client | Yarn - Package Manager
Apollo Client is a fully-featured caching GraphQL client with integrations for React, Angular, and more. It allows you to easily build UI components...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found