Chinaunix首页 | 论坛 | 博客
  • 博客访问: 601377
  • 博文数量: 90
  • 博客积分: 5111
  • 博客等级: 大校
  • 技术积分: 928
  • 用 户 组: 普通用户
  • 注册时间: 2007-11-29 16:56
文章存档

2011年(15)

2010年(34)

2009年(19)

2008年(22)

我的朋友

分类: LINUX

2010-12-08 11:13:52


★内存泄露:
Linux下在编译时开启"Debug slab memory allocation" -> "Memory leak debugging" ,然后运行过程中通过查看 /proc/下的slab_allocators看到slab的泄漏情况。不过这个只能查看slab的。

4096b及以上空间监视:
diff --git a/mm/slab.c b/mm/slab.c
index 06236e4..b379e31 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -2202,7 +2202,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
 	 * above the next power of two: caches with object sizes just above a
 	 * power of two have a significant amount of internal fragmentation.
 	 */
-	if (size < 4096 || fls(size - 1) == fls(size-1 + REDZONE_ALIGN +
+	if (size < 128*1024+1 || fls(size - 1) == fls(size-1 + REDZONE_ALIGN +
 						2 * sizeof(unsigned long long)))
 		flags |= SLAB_RED_ZONE | SLAB_STORE_USER;
 	if (!(flags & SLAB_DESTROY_BY_RCU))
参考资料:









阅读(1999) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~