Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bff091d
Basic HTTP listener program
JunielKatarn Oct 18, 2023
6967115
Add VS Code assests
JunielKatarn Oct 18, 2023
228be46
Format code
JunielKatarn Oct 18, 2023
d8082c4
Simplify code
JunielKatarn Oct 18, 2023
dffa9a3
Allow multiple subsequent requests
JunielKatarn Oct 18, 2023
e25f9ea
Cleanup commented code
JunielKatarn Oct 18, 2023
f677d56
Send arbitrary-sized hex digit strings
JunielKatarn Oct 18, 2023
386cfe0
Copy fetchwinvalidblob into fetchwinleak
JunielKatarn Oct 18, 2023
4f35444
Rename files to fetchwinleak.*
JunielKatarn Oct 18, 2023
16a25c4
Rename directories to fetchwinleak.*
JunielKatarn Oct 18, 2023
6e2a952
Change contents to fetchwinleak
JunielKatarn Oct 18, 2023
5ed0dbf
pod install
JunielKatarn Oct 18, 2023
73c4926
Rename fetchwinvalidblob
JunielKatarn Oct 18, 2023
b6a20c9
Move HTTP listener to windows/
JunielKatarn Oct 18, 2023
7efeec1
Remove HTTPList SLN
JunielKatarn Oct 18, 2023
885f9e3
Allow setting content size in request path
JunielKatarn Oct 18, 2023
0ce877b
Aim at localhost:5000
JunielKatarn Oct 18, 2023
f341a47
Upgrade to react-native-windows 0.72.14
JunielKatarn Oct 18, 2023
d8f4030
Set download size by input
JunielKatarn Oct 18, 2023
3c0a6ad
Center content and apply styles
JunielKatarn Oct 18, 2023
2604ac0
Cleanup
JunielKatarn Oct 18, 2023
30a3c54
Set TextInput value
JunielKatarn Oct 18, 2023
0a579cc
Upgrade to react-native-windows 0.72.15
JunielKatarn Oct 19, 2023
3440a39
Ignore xcshareddata
JunielKatarn Oct 19, 2023
722dcf5
Count total bytes transferred
JunielKatarn Oct 19, 2023
a612de1
Upgrade to react-native-macos 0.72.3
JunielKatarn Oct 19, 2023
fc87f16
Revert "Upgrade to react-native-macos 0.72.3"
JunielKatarn Oct 19, 2023
d09f5f6
Add macos script
JunielKatarn Oct 19, 2023
8759870
Use 8MB default downlod size
JunielKatarn Oct 19, 2023
94c0b12
Format prettier App.tsx
JunielKatarn Oct 19, 2023
95cb610
Use Hermes
JunielKatarn Oct 19, 2023
3d90e10
Skip ios Podfile
JunielKatarn Oct 20, 2023
a6fae77
Ignore .xcode.env.local
JunielKatarn Oct 20, 2023
0f510c8
Update README
JunielKatarn Oct 20, 2023
2b4cc17
Upgrade to react-native-windows 0.72.16
JunielKatarn Oct 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
957 changes: 480 additions & 477 deletions .gitignore

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions ReactNative/fetchwinleak/.bundle/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1
4 changes: 4 additions & 0 deletions ReactNative/fetchwinleak/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};
70 changes: 70 additions & 0 deletions ReactNative/fetchwinleak/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# OSX
#
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
ios/.xcode.env.local
macos/.xcode.env.local

# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore

# node.js
#
node_modules/
npm-debug.log
yarn-error.log

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/

**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output

# Bundle artifact
*.jsbundle

# Ruby / CocoaPods
/ios/Pods/
/vendor/bundle/

# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*

# testing
/coverage

# Visual Studio
.vscode/
7 changes: 7 additions & 0 deletions ReactNative/fetchwinleak/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
arrowParens: 'avoid',
bracketSameLine: true,
bracketSpacing: false,
singleQuote: true,
trailingComma: 'all',
};
1 change: 1 addition & 0 deletions ReactNative/fetchwinleak/.watchmanconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
52 changes: 52 additions & 0 deletions ReactNative/fetchwinleak/App.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* @see https://retool.com/blog/the-react-lifecycle-methods-and-hooks-explained
* @format
*/

import React, {useState} from 'react';
import {Button, StyleSheet, Text, TextInput, View} from 'react-native';

const App = () => {
const [total, setTotal] = useState(0);
const [reqId, setReqId] = useState(0);
const [size, setSize] = useState(`${8 * 1024 * 1024}`);
const uri = `http://localhost:5000/${size}`;

const doFetch = async () => {
var response = await fetch(uri);
var text = await response.text();
setReqId(reqId + 1);
setTotal(total + text.length);
};

return (
<View
style={{
flex: 1,
justifyContent: 'center',
}}>
<Button onPress={doFetch} title="Reload" />
<TextInput style={styles.input} onChangeText={setSize} value={size} />
<Text></Text>
<Text style={styles.text}>Responses: {reqId}</Text>
<Text style={styles.text}>[{total}]</Text>
</View>
);
};

const styles = StyleSheet.create({
text: {
textAlign: 'center',
},
input: {
textAlign: 'center',
color: 'white',
backgroundColor: '#003269',
fontWeight: 'bold',
},
});

export default App;
6 changes: 6 additions & 0 deletions ReactNative/fetchwinleak/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"

gem 'cocoapods', '~> 1.12'
100 changes: 100 additions & 0 deletions ReactNative/fetchwinleak/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.6)
rexml
activesupport (6.1.7.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.4)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
atomos (0.1.3)
claide (1.1.0)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.2.0)
colored2 (3.1.2)
concurrent-ruby (1.2.2)
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
ffi (1.15.5)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
json (2.6.3)
minitest (5.18.1)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.7)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.6.8)

PLATFORMS
ruby

DEPENDENCIES
cocoapods (~> 1.12)

RUBY VERSION
ruby 2.6.10p210

BUNDLED WITH
1.17.2
33 changes: 33 additions & 0 deletions ReactNative/fetchwinleak/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# `Memory leak with continuous Blob usage:`

This sample showcases the memory leak fixed for iOS, macOS [#24745](https://github.com/facebook/react-native/pull/24745), on Windows.

React Native does not trigger any clean-up mechanism when a JabaScritp `Blob` instance goes out of scope and is garbage-collected.
The associated blob data on the native side stays in memory, leading to memory leaks as subsiquent Blob objects are created/disposed.

This sample app provides the following:
- A React Native Windows app that makes `fetch` requests to an HTTP endpoint for an arbitrary number of bytes.
- A .NET HTTP listener (server) that responds to GET requests with a string of size given by the request URL path:
```
http://localhost:5000/{response_content_length}
```
- A React Native macOS projection of the app for control/reference.

## Environment

- `react-native-windows` version `0.72.15` and earlier

## Instructions

1. Start the client and server
```pwsh
yarn
npx react-native start-windows

cd windows\HttpList
dotnet run
```
1. Continuously click on `Reload`.\
Use a process monitoring tool to observe the significant increase in memory usage by the application which never goes down.

Note, the macOS variant of this app does not show memory usage issues.
17 changes: 17 additions & 0 deletions ReactNative/fetchwinleak/__tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**
* @format
*/

import 'react-native';
import React from 'react';
import App from '../App';

// Note: import explicitly to use the types shiped with jest.
import {it} from '@jest/globals';

// Note: test renderer must be required after react-native.
import renderer from 'react-test-renderer';

it('renders correctly', () => {
renderer.create(<App />);
});
Loading