I am confused as to how Android's memory is structured and managed. I want to understand the way memory is divided and shared between applications.
From what I have understood so far, every application is allocated its own Dalvik heap of memory which has a strict upper limit. This is managed using a concurrent mark-and-sweep garbage collection mechanism.
1) My question is, are only 'heaps' used in applications, or does each application have a 'stack' as well? I read here that there is a stack as well as a heap for each process (and copying GC works on the heap). Where is this stack and what is it used for?
2) The link also says that CMS is used on the stack, which does not make sense to me, because doesn't going through the stack elements sequentially kill the point of LIFO? And wouldn't compaction be required in this case?
3) Also, when processes share memory (ashmem) is it implemented as a shared heap or a shared stack?