Linux Slab分配器(五)--释放对象
| [日期:2012-06-18] |
来源:Linux社区
作者:t0nsha |
[字体:大 中 小]
|
- static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp,
- void *objp, int nodeid)
- {
-
- unsigned int objnr = obj_to_index(cachep, slabp, objp);
-
- #if DEBUG
-
- WARN_ON(slabp->nodeid != nodeid);
-
- if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) {
- printk(KERN_ERR "slab: double free detected in cache "
- "'%s', objp %p\n", cachep->name, objp);
- BUG();
- }
- #endif
-
- slab_bufctl(slabp)[objnr] = slabp->free;
-
- slabp->free = objnr;
-
- slabp->inuse--;
- }

评论声明
- 尊重网上道德,遵守中华人民共和国的各项有关法律法规
- 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
- 本站管理人员有权保留或删除其管辖留言中的任意内容
- 本站有权在网站内转载或引用您的评论
- 参与本评论即表明您已经阅读并接受上述条款
|
|
|
|