heap in dalvik

struct Heap {

    /* The mspace to allocate from.

     */

    mspace msp;

 

    /* The largest size that this heap is allowed to grow to.

     */

    //最多可增长大小

    size_t maximumSize;

 

    /* Number of bytes allocated from this mspace for objects,

     * including any overhead.  This value is NOT exact, and

     * should only be used as an input for certain heuristics.

     */

    //已经分配出去的大小

    size_t bytesAllocated;

 

    /* Number of bytes allocated from this mspace at which a

     * concurrent garbage collection will be started.

     */

    //并发gc将要启动的时候已经分配的字节数

    size_t concurrentStartBytes;

 

    /* Number of objects currently allocated from this mspace.

     */

    //当前已被分出去的对象个数

    size_t objectsAllocated;

 

    /*

     * The lowest address of this heap, inclusive.

     */

    char *base;

 

    /*

     * The highest address of this heap, exclusive.

     */

    char *limit;

 

    /*

     * If the heap has an mspace, the current high water mark in

     * allocations requested via dvmHeapSourceMorecore.

     */

    char *brk;

};

/*

     * The live object bitmap.

     */

    //所有已经分配的对象,存活的对象

    HeapBitmap liveBits;

 

    /*

     * The mark bitmap.

     */

    //所有可访问的对象

HeapBitmap markBits;

struct HeapBitmap {

    /* The bitmap data, which points to an mmap()ed area of zeroed

     * anonymous memory.

     */

    //看成地址的集合吧

    unsigned long *bits;

 

    /* The size of the used memory pointed to by bits, in bytes.  This

     * value changes when the bitmap is shrunk.

     */

    //已用内存大小

    size_t bitsLen;

 

    /* The real size of the memory pointed to by bits.  This is the

     * number of bytes we requested from the allocator and does not

     * change.

     */

    //大小不会发生改变

    size_t allocLen;

 

    /* The base address, which corresponds to the first bit in

     * the bitmap.

     */

    //基地址

    uintptr_t base;

 

    /* The highest pointer value ever returned by an allocation

     * from this heap.  I.e., the highest address that may correspond

     * to a set bit.  If there are no bits set, (max < base).

     */

    //曾经达到的最高地址

    uintptr_t max;

};

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值