main_arena是什么东西?

syouweiz 2009-03-02 04:17:09
#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
...全文
1071 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
独孤过儿 2009-03-02
  • 打赏
  • 举报
回复
这是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;
};
  • 打赏
  • 举报
回复
晕,这是什么?

23,216

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧