Navigate Memory Problem
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- ios, javascript
調査の方向性
リンクされている atabix/nativescript-memory-leak-example リポジトリから始め、@nativescript/ios 6.5.4 および 7.2.0 を使って、同じページへの1秒ごとのナビゲーションループを30分間再現します。メモリをプロファイリングしながら、参照されている NativeScript、nativescript-angular、ns-v8ios-runtime の issue を読みます。リークが切り分けられ、ナビゲーションテストで報告された増加が見られなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
I am running into a reproducible memory leak that occurs when navigating to another page.
In my example we navigate with a 1 second timeout to the same page in an endless loop.
Example Repository:
https://github.com/atabix/nativescript-memory-leak-example
➜ nativescript -v
7.2.0
Use Case 1
Run the app with all of the same dependencies with one exception:
@nativescript/ios@6.5.4
Allow the app to run for a period of thirty minutes.
Use Case 2
Run the app with all of the same dependencies with one exception:
@nativescript/ios@7.2.0
Allow the app to run for a period of thirty minutes.
Results
The app starts around ~74MB in both uses cases. In this first couple of minutes the app slowly increases in total memory used, incrementing about 1MB every couple of seconds.
After this initial period the memory seems to stabilize at around 93MB.
The same test has been applied to two very different apps in production with pages that are more complex. This example here resulted in 1MB increments. The production apps resulted in 50MB increments (starting at 146MB and eventually reaching 2GB). In combination with navigating between different kinds of pages this memory problem is compounded, eventually resulting in the app shutting itself down.
This behavior remained consistent when manually calling Utils.GC() and using clearHistory: true on navigation. These two seemed to have no affect on the outcome of the results.
Honorable mention
The issue was first discovered in a project using nativescript-vue. The funny thing is that the amount of memory in each increment used is less than vanilla NativeScript. To remove nativescript-vue as a variable the above uses cases have taken place without it.
References
https://github.com/NativeScript/NativeScript/issues/6890
- Manual garbage collection doesn't resolve the issue.
https://github.com/NativeScript/nativescript-angular/issues/1215
- The issue seems to be with Angular. A similar approach was attempted for NativeScript Vue by hooking into the destroy method of Vue components; however, as mentioned above, Vue doesn't seem to be a factor in this problem.
https://github.com/NativeScript/ns-v8ios-runtime/issues/100
- This is currently an issue in the v7.2.0 iOS runtime. Perhaps it may also be affecting other factors of NativeScript?
I am currently at a loss as to how to proceed. The issue is extremely significant in any pages that display more than a single button and some text. It's only apparent in apps where people navigate between pages a lot for an extended period of time.
- 主要言語
- 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 ·