NativeScript 5 - iOS Out of memory crash and memory leaks

Created on 23 Nov 2018  Â·  6Comments  Â·  Source: NativeScript/NativeScript

Environment

  • CLI: 5.0.1
  • Cross-platform modules: 5.0.3
  • Android Runtime: 5.0.0
  • iOS Runtime: 5.0.0
  • Plugin(s):

Component nativescript has 5.0.1 version and is up to date.
✔ Component tns-core-modules has 5.0.3 version and is up to date.
✔ Component tns-android has 5.0.0 version and is up to date.
✔ Component tns-ios has 5.0.0 version and is up to date.

Describe the bug
iOS app crashes bcs of memory leaks. Memory do not reset when app navigates between pages.

To Reproduce

tns build ios

  • open ios project in Xcode,
  • open memory report in Xcode
  • on device click on "example loop" 2-4 times
  • or click on "loop 10x"
  • Reserved memory hasnt gone in memory report, if you reach limit of memory app crashes

Expected behavior

  • reserved memory reset after page is closed, no memory leaks

image

Sample project
https://github.com/reposooo/ns-out-of-memory

Additional context
the same results with aot. Works fine with tns 3.1 see the sample project https://github.com/NativeScript/NativeScript/issues/4490

ios

Most helpful comment

Is the memory supposed to decrease between navigations? In my app--NS 5.1.1, iOS, Angular, with webpack--memory seems to increase steadily. If I hit a page that uses a lot of memory, the app stays at that level after I have navigated away (that higher level then becomes the baseline, and further memory use just sits on top of that). I have tried adding clearHistory="true" to the navigation, but that does not change this--memory keeps increasing throughout app use.

I believe this issue was meant to address this. Is there something else required for webpack?

All 6 comments

Hi @reposooo. Thank you very much for raising this issue.

It turned out that it is the same as the one we've already fixed with https://github.com/NativeScript/ios-runtime/pull/1019. Unfortunately due to some infrastructure problems which we detected today there was no @rc package published to NPM. Hopefully in less than a couple of hours there'll be a new RC package published with which you can test to confirm whether it fixes it.

To install the latest @rc version you'll have to remove your platforms/ios directory and execute tns platform add ios@rc

@mbektchiev seems like it needs a bit time to be able have that fix though @rc how can i pull that fix now and test it?

It has already been published as @rc and @next:

npm view tns-ios dist-tags --json
{
  "latest": "5.0.0",
  "next": "5.1.0-2018-11-26-121836-02",
  "rc": "5.0.1-rc-2018-11-26-133512-03",
  "test": "4.3.0-2018-08-22-01"
}

In order to test it you need to recreate the platforms/ios directory as I mentioned earlier.

@mbektchiev works perfect! Thanks a lot!

Is the memory supposed to decrease between navigations? In my app--NS 5.1.1, iOS, Angular, with webpack--memory seems to increase steadily. If I hit a page that uses a lot of memory, the app stays at that level after I have navigated away (that higher level then becomes the baseline, and further memory use just sits on top of that). I have tried adding clearHistory="true" to the navigation, but that does not change this--memory keeps increasing throughout app use.

I believe this issue was meant to address this. Is there something else required for webpack?

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Leo-lay picture Leo-lay  Â·  3Comments

dhanalakshmitawwa picture dhanalakshmitawwa  Â·  3Comments

guillaume-roy picture guillaume-roy  Â·  3Comments

rLoka picture rLoka  Â·  3Comments

vtisnado picture vtisnado  Â·  3Comments