phil917
phil917

Reputation: 113

Android heap size limit, do we still really need to design applications with a 16 MB limit in mind?

Like the title says, should I still be designing my application around a 16 MB heap size limit? The reason I ask is that I've been developing a game recently that runs fine on my nearly 2 year old Droid 2. But when I test my app using an AVD with a 16 MB heap size limit, I get out of memory errors. Monitoring my application with DDMS shows that the total memory allocated for my game is around 20 MB. It isn't a huge difference, but getting my game to work under that 16 MB limit would really hurt the visuals.

Now, if this was 2008, I wouldn't even be asking this question. But it's 2012, nearly 4 years after the G1 debuted. Is it safe to say that most phones made in the past year allow applications to allocate more than 16 MB of memory? Or am I really screwing myself by not designing my application with a 16 MB limit in mind?

Upvotes: 6

Views: 3504

Answers (2)

Tofeeq Ahmad
Tofeeq Ahmad

Reputation: 11975

Yes we still need it but not in every case. If you are using native code then memory allocated by c compiler does not include in this limit.So you can provide more memory to your application essential component. and second way is to using Texture to draw images using OpenGL.then memory for these Texture does not include from limited memory.

But these technique can not be implement in every case

One more important thing , you can not use these 30 MB completely also.Only 30 % of it is usable for one application .

Upvotes: 2

Mark Gjøl
Mark Gjøl

Reputation: 1882

The heap limit varies depending on the device resolution (and probably also other factors). So on a high resolution device the heap limit may be 30MB while on a low resolution G1 it is 16MB. Generally you should change your graphics accordingly so low resolution devices uses low resolution graphics (which takes up less space) and high resolution devices uses high resolution graphics (which takes up more space).

Upvotes: 6

Related Questions