Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android]FrameRenderer is creating new FrameDrawable every time BackgroundColor changes without disposing #5446

Closed
sstragier opened this issue Mar 4, 2019 · 1 comment · Fixed by #5617
Projects

Comments

@sstragier
Copy link

@sstragier sstragier commented Mar 4, 2019

Description

When the BackgroundColor or CornerRadius properties of a Frame are changed, the FrameRenderer (not the FastRenderer), creates a new instance of the FrameDrawable without disposing the previous instance.

For my project, we have multiple frames that have blinking background colors and over a couple minutes, the blinking visibly slows down, and if left long enough, the app crashes. Because the FrameDrawable isn't being disposed, the Bitmap is still using memory and the listener for the Frame's property changes is still listening and still drawing the background to the bitmap.

Steps to Reproduce

  1. Ensure the Android Activity is not AppCompat
    • AppCompat is using the FastRenderer which doesn't have this issue
  2. Add a couple frames to a page
  3. Set a timer to fire every 250ms and to change the background color every time it fires

Expected Behavior

The frames should keep blinking at the same frequency (every 250ms)

Actual Behavior

After a couple minutes, the blinking of the frames slows down. The Android Choreographer will start to log that the UI thread is doing too much and that frames are being skipped. Eventually the app will crash due to running out of memory

Basic Information

  • Version with issue: 3.4.0 through 3.5.0
  • Last known good version: 3.3.0.912540 (it seems this issue was introduced with pull request #3933)
  • IDE: Visual Studio 2017 (15.9.5)
  • Platform Target Frameworks:
    • Android: 8.1
  • Affected Devices: Emulator

Reproduction Link

App.zip

@sstragier sstragier added the t/bug 🐛 label Mar 4, 2019
@pauldipietro pauldipietro added this to New in Triage Mar 4, 2019
sstragier pushed a commit to sstragier/Xamarin.Forms that referenced this issue Mar 4, 2019
@sstragier sstragier changed the title FrameRenderer on Android is creating new FrameDrawable every time BackgroundColor changes without disposing [Android]FrameRenderer is creating new FrameDrawable every time BackgroundColor changes without disposing Mar 4, 2019
sstragier pushed a commit to sstragier/Xamarin.Forms that referenced this issue Mar 4, 2019
@samhouts samhouts added the p/Android label Mar 5, 2019
@samhouts samhouts added this to In Progress in v4.1.0 Mar 6, 2019
@samhouts samhouts removed this from New in Triage Mar 7, 2019
@kingces95

This comment has been minimized.

Copy link
Member

@kingces95 kingces95 commented Mar 7, 2019

image

@kingces95 kingces95 mentioned this issue Mar 19, 2019
2 of 3 tasks complete
rmarinho added a commit that referenced this issue Mar 27, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Mar 27, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Mar 27, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Mar 28, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Mar 29, 2019
adrianknight89 added a commit to adrianknight89/Xamarin.Forms that referenced this issue Mar 29, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 1, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 2, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 3, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 3, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 3, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 4, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 4, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 4, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 5, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 5, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 8, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 8, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 9, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 9, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 10, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 11, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 15, 2019
@samhouts samhouts moved this from Done to In Progress in v4.1.0 Apr 15, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Apr 16, 2019
codemillmatt added a commit to codemillmatt/Xamarin.Forms that referenced this issue Apr 19, 2019
@samhouts samhouts added this to In Progress in v4.2.0 May 29, 2019
@samhouts samhouts removed this from Done in v4.1.0 May 29, 2019
@samhouts samhouts moved this from In Progress to Done in v4.2.0 May 29, 2019
@samhouts samhouts removed this from Done in v4.2.0 Jun 4, 2019
@samhouts samhouts added this to In Progress in v4.1.0 Jun 4, 2019
@samhouts samhouts moved this from In Progress to Done in v4.1.0 Jun 5, 2019
AxelUser added a commit to AxelUser/Xamarin.Forms that referenced this issue Jun 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
v4.1.0
  
Done
3 participants
You can’t perform that action at this time.