Using Processes to Avoid OutOfMemoryErrors
Do you want to increase available memory (heap) size? Check out this simple trick and avoid utOfMemoryErrors!
One of the ways to increase available memory (heap) size is to divide application to separate processes. Each <activity>
, <service>
, <receiver>
and <provider>
can specify a process in which it should run. To do this just set
1 | android:process="com.example.appname" |
attribute in particular tag in AndroidManifest.xml. Where com.example.appname
is desired process name. You can assign multiple components to one process.
More info can be found in official Android API Guide
Do not use static variables to pass data between components declared to run in different processes. Process can be killed and started by system without your control. When process is started “fresh” class of component is loaded.
About the author
Ready to take your business to the next level with a digital product?
We'll be with you every step of the way, from idea to launch and beyond!