1 Star 0 Fork 10

jinlun/dim_9

forked from src-openEuler/dim 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Add-memory-debug-in-mem_pool.patch 1.04 KB
一键复制 编辑 原始数据 按行查看 历史
jinlun 提交于 2024-04-16 10:12 . backport some patches
From 2ca49371b548b56d192f571866fb28c548746ad1 Mon Sep 17 00:00:00 2001
From: Huaxin Lu <luhuaxin1@huawei.com>
Date: Mon, 19 Feb 2024 10:35:34 +0800
Subject: [PATCH 20/26] Add memory debug in mem_pool
---
src/core/dim_core_mem_pool.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/core/dim_core_mem_pool.c b/src/core/dim_core_mem_pool.c
index 974033f..a9f0177 100644
--- a/src/core/dim_core_mem_pool.c
+++ b/src/core/dim_core_mem_pool.c
@@ -4,6 +4,7 @@
#include <linux/mm.h>
+#include "dim_safe_func.h"
#include "dim_utils.h"
#include "dim_core_mem_pool.h"
@@ -108,6 +109,9 @@ void *dim_mem_pool_alloc(size_t size)
if (data == NULL)
return NULL;
out:
+ #ifdef DIM_DEBUG_MEMORY_LEAK
+ dim_alloc_debug_inc();
+ #endif
data->size = mem_size;
return data->data;
}
@@ -130,6 +134,10 @@ void dim_mem_pool_free(const void *data)
}
gen_pool_free(dim_pool, (uintptr_t)mem, mem->size);
+
+ #ifdef DIM_DEBUG_MEMORY_LEAK
+ dim_alloc_debug_dec();
+ #endif
}
void dim_mem_pool_walk_chunk(pool_chunk_visitor f, void *data)
--
2.33.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jinlun123123/dim_9.git
git@gitee.com:jinlun123123/dim_9.git
jinlun123123
dim_9
dim_9
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385