Memory Leak on Page Navigation on NS7
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 20/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- ios, javascript
調査の方向性
まず、リンクされている NS7 と NS6 のサンプルプロジェクトでリークを再現し、次に iOS でページ遷移を繰り返した際のプロファイリングを行って、Android と動作を比較します。保持されたメモリの原因が特定され、ページ遷移によって報告されているメモリ増加や最終的なフリーズが発生しなくなれば、Issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
Environment
"@nativescript/core": "7.3.0"
"nativescript-vue": "^2.8.1"
"@nativescript/ios": "7.2.0"
✔ Component nativescript has 7.2.1 version and is up to date.
✔ Component @nativescript/core has 7.3.0 version and is up to date.
✔ Component @nativescript/ios has 7.2.0 version and is up to date.
Describe the bug
NS is not freeing memory on page navigations on iOS. When profiling, on each page navigation, the memory increases and app gets slower until, at some point, the app freezes or the OS terminates the app. This behaviour is restricted to IOS, we have profiled with the Android Runtime (https://github.com/NativeScript/android-runtime) and the garbage collection works as expected.
On a very simple application, two included below, each page navigation increases the memory footprint of the app by 60 - 80 megs until the app reaches 1 - 2 Gigs and stops working. If we have a complex page, with some images, and scroll on a list then the memory increases in small iterations but once we navigate to a new page, the memory jumps by 60 - 80 megs.
We have created several test apps with Vue and Angular and the memory leak occurs irrespective of the JS framework.
Solutions Tried and Reviewed
-
The same issues has been posted previously - Memory Leak on 7.2.0 with (https://github.com/NativeScript/ns-v8ios-runtime)
https://github.com/NativeScript/ns-v8ios-runtime/issues/105We have also:
EnableProdMode: Is there something similar to enable prod mode on Vue
https://github.com/NativeScript/nativescript-angular/issues/1215
Markingmode: https://nativescript.org/blog/markingmode-none-is-official-boost-android-performance-while-avoiding-memory-issues/ -
Downgraded Nativescript iOSCore to 6.5.4 (https://github.com/NativeScript/ios-runtime).
We experience the same issues with the older runtime.
-
Manually destroyed the component - tried different call backs (Unloaded for example)
https://github.com/nstudio/nativescript-videoplayer/issues/129 -
Tried with Angular (its happening even on the creation project templates)
-
Tried with the templates project with 6.5.4
-
Set the V8flags in the config for IOS (on the V8 Runtime https://github.com/NativeScript/ns-v8ios-runtime)
-
Navigating with the clearHistory flag (set to true) and navigateBack method = same result
-
Tested on simulators and real iPhones. (iOS 12.4.8, iOS 13.1, 13.3.1)
-
Tested with different Layouts (complex and simple)
-
Manually calling the GC in the navigate back method reduces the memory by a small percentage (0.1% - 0.3%).
-
As mentioned, it works on Android, see the profiling from below.

Project Examples
We include two sample projects, the first is NS7 and the second NS6, both exhibit the same issues with memory.
NS7: https://github.com/alkimiiapps/memoryleakexample
NS6: https://github.com/alkimiiapps/ns6test
Example Video of the memory reaching 0.5 Gig
Here is a gif of the profiling, where the user navigates back and forth between pages and the memory increases with each navigation.
- 主要言語
- JavaScript
- スター
- 150
- フォーク
- 43
- 平均マージ
- 3日 10時間
- マージ済み PR(30日)
- 22
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/ios のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
NativeScript/ios#459 · コメント 1 件 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
NativeScript/ios#445 ·
-
難易度 3/5 3〜5日 初心者へのやさしさ 66/100
NativeScript/ios#414 ·
-
question
難易度 4/5 3〜5日 初心者へのやさしさ 34/100
NativeScript/ios#364 · コメント 2 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NativeScript/ios#355 ·
NativeScript/ios の issue をすべて見る
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
matrix-org/matrix.org#3649 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
