ashmem
ashmem
Posted Dec 21, 2011 2:19 UTC (Wed) by swetland (guest, #63414)Parent article: Bringing Android closer to the mainline
One very important goal for ashmem was addressing "how do apps obtain memory that can be shared with peer processes without creating resource leaks." On traditional Linux systems, creating a file in /tmp (tmpfs), truncating it, unlinking it, and passing the fd around gives you a mechanism for creating and sharing anonymous memory.
However, Android systems do not have a writable tmpfs to avoid having to deal with cleaning up after buggy or malicious apps filling up /tmp. The low memory killer will eject apps (especially background apps) that are using needed memory, and since ashmem allocated regions don't persist beyond owner-process-lifetime, they get cleaned up at that point.
ashmem sits on top of the underlying infrastructure that supports tmpfs, aiming to re-use as much as possible here.
