2

Memory Management

2.1 Overview

Memory is an important resource for any computing system. However, memory management is different from managing some other resources in the sense that there can be no single module that would be responsible for memory management in isolation of the rest of the system. Instead, memory use is necessarily tangling everywhere in a program. Furthermore, when considering programming mobile devices memory is a critical resource, because in an attempt to keep the cost of the device low, manufacturers include only a restricted amount of it in devices although all the running programs are competing for it. Moreover, in addition to forming a considerable cost factor, memory chips also consume some power, the amount of which depends on the amount of memory included in the device. Therefore, many devices are limited with respect to their memory also due to this reason.

At the same time, memory is a crucial resource whose use cannot be abstracted away. Instead, programmers essentially define how memory is used in programs, as a common goal of language design has been to enable explicit allocation of memory in many imperative languages, such as C and C++. Furthermore, the way programmers write their programs has a large contribution to the memory usage of the program. In fact, in some mobile platforms, almost all programs show signs of preparation for the case where the program runs out of memory or some other resources, making memory consumption a cross-cutting ...

Get Programming Mobile Devices: An Introduction for Practitioners now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.