当前位置:  技术问答>linux和unix

main_arena是什么东西?

    来源: 互联网  发布时间:2016-05-21

    本文导语:  #0  0x0086a159 in main_arena () from /lib/libc.so.6 #1  0x0806751a in fun_name_a (this=0xa7537e0, r=ReleaseMe,      p=0xa83c6a0) at filename.cxx:1945 #2  0x0806db99 in fun_name_b (pB=0xa7537e0)     at filename.cxx:2184 #3  0x008a343b in start_thread ...

#0  0x0086a159 in main_arena () from /lib/libc.so.6
#1  0x0806751a in fun_name_a (this=0xa7537e0, r=ReleaseMe, 
    p=0xa83c6a0) at filename.cxx:1945
#2  0x0806db99 in fun_name_b (pB=0xa7537e0)
    at filename.cxx:2184
#3  0x008a343b in start_thread () from /lib/libpthread.so.0
#4  0x007fafde in clone () from /lib/libc.so.6

|
这是malloc()实现过程中的一个结构体,具体代码如下:

/* There are several instances of this struct ("arenas") in this
   malloc.  If you are adapting this malloc in a way that does NOT use
   a static or mmapped malloc_state, you MUST explicitly zero-fill it
   before using. This malloc relies on the property that malloc_state
   is initialized to all zeroes (as is true of C statics).  */

static struct malloc_state main_arena;

/*
   ----------- Internal state representation and initialization -----------
*/

struct malloc_state {
  /* Serialize access.  */
  mutex_t mutex;

  /* Flags (formerly in max_fast).  */
  int flags;

#if THREAD_STATS
  /* Statistics for locking.  Only used if THREAD_STATS is defined.  */
  long stat_lock_direct, stat_lock_loop, stat_lock_wait;
#endif

  /* Fastbins */
  mfastbinptr      fastbins[NFASTBINS];

  /* Base of the topmost chunk -- not otherwise kept in a bin */
  mchunkptr        top;

  /* The remainder from the most recent split of a small request */
  mchunkptr        last_remainder;

  /* Normal bins packed as described above */
  mchunkptr        bins[NBINS * 2 - 2];

  /* Bitmap of bins */
  unsigned int     binmap[BINMAPSIZE];

  /* Linked list */
  struct malloc_state *next;

  /* Memory allocated from the system in this arena.  */
  INTERNAL_SIZE_T system_mem;
  INTERNAL_SIZE_T max_system_mem;
};

|
晕,这是什么?

    
 
 

您可能感兴趣的文章:

 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3