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.

Memory leak on iOS

See original GitHub issue

Following up on the closed issue https://github.com/react-native-community/react-native-netinfo/issues/325

This does seem to be an issue with memory leaks, which occur on app start.

Simple reproduction is init a new RN app ad add

React.useEffect(() => {
    const unsubscribe = NetInfo.addEventListener(() => {});
    return () => unsubscribe();
  }, []);

Environment

System:
    OS: macOS 10.15.7
    CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
    Memory: 1.20 GB / 32.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
    Yarn: 1.22.5 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /Users/oliverwinter/.rvm/gems/ruby-2.6.1/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 12.0.1/12A7300 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_242 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.3 => 0.63.3 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Platforms

Memory leaks were found in iOS on device iPhone 11 pro 14.0.1

Versions

@react-native-community/netinfo”: “5.9.7”,

Description

Screen Shot 2020-10-15 at 1 44 24 pm

Reproducible Demo

add effect in new app and profile on device to see leaks on app start

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:18 (10 by maintainers)

github_iconTop GitHub Comments

4reactions
owinter86commented, Oct 15, 2020

I can confirm issue also exists when using the useNetInfo hook

const connected = useNetInfo();
2reactions
mikehardycommented, Oct 8, 2021

The beauty of open source is that if there are updates everyone can see them immediately. There’s no secret updates. Anyone that wants to tackle this may feel free @hypothete ? 🙏

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Are iOS Memory Leaks and How to Detect Them?
A memory leak is a piece of memory that was allocated at one point but never released, and is also no longer referenced...
Read more >
Everything you need to know about Memory Leaks in iOS
A memory leak occurs when a given memory space cannot be recovered by the ARC (Automatic Reference Count) because it is unable to...
Read more >
Detecting Memory Leaks in iOS - Dev Genius
Basically, a memory leak is when an object that should have been released from memory did not get deinitialized and it's still lingering...
Read more >
How to detect iOS memory leaks and retain cycles using ...
A memory leak in iOS is when an amount of allocated space in memory cannot be deallocated due to retain cycles. Since Swift...
Read more >
Making changes to reduce memory use
Eliminate memory leaks ... A memory leak occurs when allocated memory becomes unreachable and the app can't deallocate it. Allowing an allocated-memory pointer...
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