看啥推荐读物
专栏名称: Python开发者
人生苦短,我用 Python。伯乐在线旗下账号「Python开发者」分享 Python 相关的技术文章、工具资源、精选课程、热点资讯等。
今天看啥  ›  专栏  ›  Python开发者

Python 源码阅读:内存管理机制(2)

Python开发者  · 公众号  · Python  · 2017-10-17 21:04
(点击上方蓝字,快速关注我们)作者: wklken如有好文章投稿,请点击 → 这里了解详情Python 的内存分配策略arenaarena: 多个pool聚合的结果arena sizepool的大小默认值位4KBarena的大小默认值256KB, 能放置 256/4=64 个poolobmalloc.c中代码#define ARENA_SIZE              (256 arena 结构一个完整的arena = arena_object + pool集合typedef uchar block; /* Record keeping for arenas. */struct arena_object {    /* The address of the arena, as returned by malloc.  Note that 0     * will never be returned by a successful malloc, and is used     * here to mark an arena_object that doesn't correspond to an     * allocated arena.     */    uptr address;     /* Pool-aligned pointer to the next pool to be carved off. */    block* pool_address;     /* The number of available pools ………………………………

原文地址:访问原文地址
快照地址: 访问文章快照