Skip to content

Memory leak when using slide transition on Android (API Level 23) #2741

@shripalsoni04

Description

@shripalsoni04

Did you verify this is a real problem by searching [Stack Overflow]

Yes

Tell us about the problem

In my sample application to show the memory leak issue, I have two pages. On first page there is only button and on tap on that button, we are navigated to page 2. On Page 2, I have a Label in StackLayout.

Now, when we set page transition to 'slide', it is causing a memory leak on Android API Level 23. Memory keep on increasing on transition till OOM. When I tested that on emulator with API Level 21 and 22, It is not causing any memory leak.

Please check the below heap dump taken on API 23 version showing ImageViews being generated on slide transition are remaining in memory.
memory-leak-heap-dump

Attaching the path2gc for this image, which may help you in finding the memory leak root.
path2gc

When I checked, what these images are, I found that it is creating screenshot of both the pages on navigation. Below are that Images, which are keep on adding in memory on transition.
image1

image2

Also, I found that, it is not releasing Label in Page 2 on transition. So Labels also keep on adding into memory.

Which platform(s) does your issue occur on?

Android

Please provide the following version numbers that your issue occurs with:

  • CLI: 2.3.0
  • Cross-platform modules: Tested on both 2.3.0 and 2.4.0-2016-09-16-4127
  • Runtime(s): tns-android: 2.3.0

Please tell us how to recreate the issue in as much detail as possible.

  1. Clone this sample app
  2. Run on Android API 23.
  3. Do transition between two pages for around 10 times.
  4. You can either log heapMemory on button click, or take heapDump from Android Monitor and analyse it in Android Studio or Eclipse MAT.

Is there code involved? If so, please share the minimal amount of code needed to recreate the problem.

Basic sample app to reproduce this issue: https://github.com/shripalsoni04/ns-transition-memory-leak

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions