Reference Link: http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2016/0111/3859.html
New Memoryfile (null, inputstream.available ()); Memoryfile.allowpurging (false= Memoryfile.getoutputstream (); Outputstream.write (1024x768);
The memory allocated by Memoryfile does not occupy Java heap memory and does not even occupy app memory under 4.4 systems. More than 4.4 of the system app memory count is included in the Ashmem memory, including this part.
Memoryfile is a set of frameworks that Android introduced at the very beginning, which actually encapsulates the unique memory-sharing mechanism of Android Ashmem Anonymous shared memory, which simply means that Ashmem is registered as a special character device in the Android kernel, The Ashmem driver initializes a memory area in a custom slab buffer in the kernel, and then maps the requested memory to the user's process space through the mmap (via TMPFS), which allows the memory requested here to be used in the user process, in addition, One of the features of Ashmem is the ability to reclaim memory that is labeled "Unpin" when the system is out of memory, which is described later, and memoryfile can also be used by binder to share a memory area across processes for two processes. Since the entire process of applying for memory is no longer on the Java layer, it is clear that the memory used by the Memoryfile application does not actually consume Java heap memory.
Memoryfile Stealing Android Memory