Category: Android, Blog, Development

Using Processes to Avoid OutOfMemoryErrors

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

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.

Karol Wrótniak

Karol Wrótniak

Android Developer

Android Developer with 10 years of experience. A warhorse with impressive experience and skills in native and Flutter app development. Karol is probably the most active contributor to open source libraries you've ever met. He develops Gradle plugins and Bitrise steps, and he is engaged in many projects, in particular those related to testing. Karol has been engaged as a speaker in many events and meetups like DevFest, 4Developers Wrocław, JDD Conference, Linux Academy, and more. He is an active member of Google Developers Group Wrocław, Flutter Wrocław, and Bitrise User Group.