Memory Leak on Page Navigation on NS7
Mantenedores costumam responder em até 2 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 20/100
- Tipo de issue
- Bug
- Clareza
- Precisa de esclarecimento
- Status de atividade
- Estagnada
- Stack de tecnologia
- ios, javascript
- Domínio
- mobile-dev, performance
Direção de pesquisa
Comece reproduzindo o vazamento com os projetos de exemplo NS7 e NS6 vinculados, depois faça o profiling da navegação repetida entre páginas no iOS e compare o comportamento com o Android. A issue estará concluída quando a origem da memória retida for identificada e a navegação não causar mais o crescimento de memória relatado nem o eventual congelamento.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 150
- Forks
- 44
- Merge médio
- 3d 23h
- PRs com merge (30d)
- 19
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de NativeScript/ios
-
interop.FunctionReference function passed as a block, then as a function pointer, assertsTalvez já em andamento @edusperoni assumiu há 2 dias. Aberta
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 22/100
NativeScript/ios#503 ·
Mantenedores costumam responder em até 2 dias
-
isImplementedInClass leaks the losing sample instance on re-entrant or racing cache populationAberta
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 38/100
NativeScript/ios#459 · 1 comentário ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 3/5 3-5 dias Facilidade para iniciantes 66/100
NativeScript/ios#414 ·
Mantenedores costumam responder em até 2 dias
-
question
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 34/100
NativeScript/ios#364 · 2 comentários ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 35/100
NativeScript/ios#355 ·
Mantenedores costumam responder em até 2 dias
Todas as issues de NativeScript/ios
Issues semelhantes
-
bug MVP
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
saayam-for-all/webapp#1911 ·
Mantenedores costumam responder em até 1 dia
-
[Focus] Accessibility (a11y) [Package] Grid [Type] Bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 76/100
Mantenedores costumam responder em até 1 dia
-
Cancelled query leaves stale row index; next query on the connection returns leading empty slotsTalvez já em andamento @pislm assumiu hoje. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
Mantenedores costumam responder em até 7 dias
-
Harden bayesian-waves-bg.js: add prefers-reduced-motion, pointer-events guard, and hidden-tab pauseAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 90/100
njitacm/njit-acm-website#109 ·
