源码地址:http://androidxref.com/5.1.0_r1/xref/art/runtime/runtime.h#555
通过手段拿到Runtime指针runtime*后,想通过偏移量去拿heap_的指针,看网上有类似代码,heap的偏移量为188,求大神解答为何是188。
相关代码:
JavaVMExt *vmExt = (JavaVMExt *) mirror_vm;
char *runtime_ptr = (char *) vmExt->runtime;
void **heap_pp = (void **) (runtime_ptr + 188);
char *c_heap = (char *) (*heap_pp);
char *min_free_offset = c_heap + 532;
char *max_free_offset = min_free_offset + 4;
size_t *min_free_ = (size_t *) min_free_offset;
size_t *max_free_ = (size_t *) max_free_offset;
*min_free_ = 1024 * 1024 * min;
*max_free_ = 1024 * 1024 * max;