0 votes
in JQuery by
How does the OutOfMemory happens in Android?

1 Answer

0 votes
by

Out of memory error is very common error when you are developing for a application that deals with multiple images sets or large bitmaps or some Animation stuff. In Android, every application runs in a Linux Process. Each Linux Process has a Virtual Machine (Dalvik Virtual Machine) running inside it. There is a limit on the memory a process can demand and it is different for different devices and also differs for phones and tablets. When some process demands a higher memory than its limit it causes a error i.e Out of memory error.

There are number of reasons why we get a Out of memory errors. Some of those are:

  1. You are doing some operation that continuously demands a lot of memory and at some point it goes beyond the max heap memory limit of a process.

  2. You are leaking some memory i.e you didn’t make the previous objects you allocated eligible for Garbage Collection (GC). This is called Memory leak.

    1. You are dealing with large bitmaps and loading all of them at run time. You have to deal very carefully with large bitmaps by loading the size that you need not the whole bitmap at once and then do scaling.

Related questions

0 votes
asked Jun 22, 2020 in JQuery by DavidAnderson
+1 vote
asked Aug 3, 2020 in JQuery by Hodge
...