For allocating a memory region in dalvik heap, applications use dlmalloc, instead of normal malloc, Why dlmalloc is used, and how it differs from malloc. (As per I know, for allocating dalvik heap while creating dalvik VM, malloc is used.)
The high-order bit was that Dalvik needed to have an underlying allocator that was separate from the default malloc-managed heap, so it could have the right kind of control over how allocation happened, knowing that other subsystems wouldn't be interfering.
As it turned out, dlmalloc was a reasonably-mature existing library that provided the isolation and the hooks we needed. The intent (up to the point when I left the team) was that eventually we'd replace it with something more bespoke, but it never became a sufficiently pressing issue to take that particular plunge.
As for detailed differences between dlmalloc and malloc: dlmalloc is a specific implementation of the traditional libc malloc API, whereas "malloc" per se isn't specific to a particular implementation. But even if you got specific, I doubt I could suggest anything more than "read the code" anyway.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With