rive-app / rive-android

A runtime for interactive animations on Android
https://rive.app
MIT License
332 stars 30 forks source link

Really high memory usage with idle animations in Android #325

Open Karn opened 2 months ago

Karn commented 2 months ago

Description

Using a simple idle animation results in almost double memory usage.

Without animation With animation

Provide a Repro

Attached is a sample project. Comment out RiveAnimation usage in MainActivity to see sample before.

Sample project: rive-sample.zip

Source .riv/.rev file

Borrowed sample from: https://rive.app/community/files/9467-18018-mememoji/

me.riv.zip

Expected behavior

lower memory usage.

Screenshots

Device & Versions (please complete the following information)

Additional context

csmartdalton commented 1 month ago

Wow! 120 MB is a LOT! 😱

Thank you for the test case. We are just now in the process of making the Rive renderer default on Android & iOS. The currently-default renderer on Android will fill up its cache quickly on an idle animation like this, leading to large memory usage like you're seeing here.

If you enable the pre-release Rive renderer do you see better memory usage? (I don't recommend releasing with the Rive renderer yet, since there are still some devices with issues, but it should give you an idea of where things will land in the near future.) Also note that the Rive renderer currently uses OpenGL on Android. We are actively finishing up the Vulkan implementation, which will also get better memory usage.