Android NDK: Dalvik Heap and Native Heap - How Separate Between the two

前端 未结 3 1700
青春惊慌失措
青春惊慌失措 2021-02-04 05:45

I know there\'s Dalvik(JVM) heap and Native heap in an android platform. And the Dalvik GC has no work on native heap. But I\'m not sure how this work, I mean how the Android OS

3条回答
  •  我在风中等你
    2021-02-04 06:21

    The native heap is managed by dlmalloc(), which uses a combination of mmap() and standard calls like sbrk() to allocate memory. The managed ("Dalvik") heap is (mostly) one large chunk allocated with mmap(). It's all running on top of the Linux kernel, so if you understand Linux memory management then you already know how the lower-level parts work.

    You can read more about how Dalvik returns empty pages from the managed heap to the OS in this post.

    Edit: the canonical post for information about Android memory management is this one. I don't think it directly answers your question, but it has a lot of good information and links to informative sites.

提交回复
热议问题