react-native-windows
react-native-windows copied to clipboard
Memory leak issue in UWP
Environment
react-native -v: 0.50.3npm ls rnpm-plugin-windows: 0.2.8npm ls react-native-windows: 0.50.0-rc2node -v: 7.7.4npm -v: 4.1.2
Then, specify:
- Target Platform: UWP
- Target Platform Version(s): 10.0.14393
- Target Device(s): Desktop x64
- Development Operating System: Windows
- Visual Studio Version: Visual Studio 2017
Steps to Reproduce
export default class App extends Component<{}> {
constructor(props) {
super(props);
this.state = {
data: [],
test: true
}
this.syncDataFromServ = this.syncDataFromServ.bind(this);
}
async getMoviesFromApi() {
try {
let response = await fetch('https://facebook.github.io/react-native/movies.json');
let responseJson = await response.json();
return responseJson.movies;
} catch(error) {
console.error(error);
}
}
async syncDataFromServ() {
let data = await this.getMoviesFromApi();
this.setState({data});
this.setState({test: !this.state.test});
}
componentWillMount() {
setInterval(this.syncDataFromServ, 2000);
}
render() {
return (
<View style={styles.container}>
<FlatList
data={this.state.data}
renderItem={({item}) => <Text>{this.state.test? item.title: item.releaseYear}</Text>}
keyExtractor={(item, index) => index}
/>
</View>
);
}
}
Expected Behavior
It should trigger garbage collection.
Actual Behavior
It seems like memory leak happened
Reproducible Demo

After 8 hours, it increases to 3000mb
We are not investing in new features or lower priority bug fixes on vCurrent. The bulk of investment is now in vNext as we prepare to make that the default choice. If this issue is still relevant on the vNext implementation please open a vNext issue. If this issue is of significant severity for a vCurrent app and vNext is not an option, re-open with justification.