Memory Leak on Page Navigation on NS7
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 20/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- ios, javascript
- Lĩnh vực
- mobile-dev, performance
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện sự rò rỉ với các dự án mẫu NS7 và NS6 được liên kết, sau đó lập hồ sơ việc điều hướng trang lặp lại trên iOS và so sánh hành vi với Android. Issue được hoàn tất khi xác định được nguồn của phần bộ nhớ bị giữ lại và việc điều hướng không còn gây ra mức tăng bộ nhớ được báo cáo hoặc tình trạng đóng băng cuối cùng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- JavaScript
- Star
- 150
- Fork
- 43
- Merge trung bình
- 3 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 22
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của NativeScript/ios
-
isImplementedInClass leaks the losing sample instance on re-entrant or racing cache population Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
NativeScript/ios#459 · 1 bình luận ·
-
worker.terminate() is a no-op during entry evaluation, and terminating there wedges teardown Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
NativeScript/ios#445 ·
-
Độ khó 3/5 3-5 ngày Mức phù hợp với người mới 66/100
NativeScript/ios#414 ·
-
question
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 34/100
NativeScript/ios#364 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
NativeScript/ios#355 ·
Tất cả issue của NativeScript/ios
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
palladius/rails8-app-on-gcp#145 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
dotenvx/dotenv-vscode#139 ·
-
test-change-proposal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
web-platform-tests/interop#1455 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
corsairdev/corsair#1764 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
