Environment
Environment:
OS: macOS High Sierra 10.13.5
Node: 6.11.1
Yarn: 1.6.0
npm: 3.10.10
Watchman: 4.9.0
Xcode: Not Found
Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4
Description
A simple fetch call like the one below is enough to make various parts of RCTNetwork pile up references and memory allocations via malloc and etc. When I say pile up, what I mean is that every GET call is actually malloc-ing and retaining some data that never goes away. Simulating a low memory warning in Instruments also doesn't seem to get these references garbage collected away.
Reproducibility: 100%
setInterval(() => {
fetch('https://facebook.github.io/react-native/movies.json')
.then((response) => response.json())
}, 1000)
Screenshot 1

Screenshot 2
Screenshot 3
Screenshot 4
Some of the more obvious locations that I observed to be leaking:
TLDR: I'm not too familiar with the inner workings with RCTNetwork but the memory allocation seems to suggest that something funky is going on with the completionBlock which is leading to the retention of these references.
This is also a continuation of the conversation we had in #19169. @oNaiPs, you might be interested in this. 😄
Reproducible Demo
- Clone this basic RN project @ https://github.com/yinghang/react-native-leak
- Profile app with
Instruments using Allocations
- Watch
RCTNetwork related references pile up
Environment
Description
A simple fetch call like the one below is enough to make various parts of
RCTNetworkpile up references and memory allocations viamallocand etc. When I say pile up, what I mean is that everyGETcall is actuallymalloc-ing and retaining some data that never goes away. Simulating a low memory warning in Instruments also doesn't seem to get these references garbage collected away.Reproducibility: 100%
Screenshot 1
Screenshot 2
Screenshot 3
Screenshot 4
Some of the more obvious locations that I observed to be leaking:
completionBlockTLDR: I'm not too familiar with the inner workings with
RCTNetworkbut the memory allocation seems to suggest that something funky is going on with thecompletionBlockwhich is leading to the retention of these references.This is also a continuation of the conversation we had in #19169. @oNaiPs, you might be interested in this. 😄
Reproducible Demo
InstrumentsusingAllocationsRCTNetworkrelated references pile up