开发者

Question on Memory Issues in Android

开发者 https://www.devze.com 2023-03-05 14:46 出处:网络
Will there be a memory issue if we use lot of frame b开发者_运维知识库y frame animation in androidThat depends entirely upon how you implement it, and details such as how large your frames are and wha

Will there be a memory issue if we use lot of frame b开发者_运维知识库y frame animation in android


That depends entirely upon how you implement it, and details such as how large your frames are and what kind of color-depth you choose to use. In general, however, you should be able to come up with a rendering algorithm that doesn't hold references to more than a handful of frames at any one point in time.

Ideally you should only need a reference to the previous frame and your working buffer for the current frame. Assuming that's the case, and assuming that you're using 8-bit RGBA pixel encoding, then you can easily work out how approximately much memory your animation will consume when running. It's:

frame.width * frame.height * 4 * 2 bytes

And then from that you can make a reasonable estimate of whether or not your device can meet your memory requirements. As a general rule, as long as your frames are not larger than your device resolution you should be okay.

0

精彩评论

暂无评论...
验证码 换一张
取 消