Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
loser646
TDengine
提交
fc6737ab
T
TDengine
项目概览
loser646
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
fc6737ab
编写于
11月 14, 2019
作者:
weixin_48148422
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add option 'autoDump' for memory leak detection.
上级
32abecfb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
20 addition
and
17 deletion
+20
-17
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
+1
-1
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+3
-3
src/inc/tutil.h
src/inc/tutil.h
+1
-1
src/system/detail/src/dnodeService.c
src/system/detail/src/dnodeService.c
+2
-2
src/util/src/tmem.c
src/util/src/tmem.c
+13
-10
未找到文件。
src/client/jni/com_taosdata_jdbc_TSDBJNIConnector.h
浏览文件 @
fc6737ab
...
...
@@ -15,7 +15,7 @@ extern "C" {
* Signature: (Ljava/lang/String;)V
*/
JNIEXPORT
void
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_detectMemoryLeakImp
(
JNIEnv
*
,
jclass
,
jstring
);
(
JNIEnv
*
,
jclass
,
jstring
,
jboolean
);
/*
* Class: com_taosdata_jdbc_TSDBJNIConnector
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
fc6737ab
...
...
@@ -111,13 +111,13 @@ void jniGetGlobalMethod(JNIEnv *env) {
jniTrace
(
"native method register finished"
);
}
JNIEXPORT
void
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_detectMemoryLeakImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jPath
)
{
JNIEXPORT
void
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_detectMemoryLeakImp
(
JNIEnv
*
env
,
jobject
jobj
,
jstring
jPath
,
jboolean
jAutoDump
)
{
if
(
jPath
!=
NULL
)
{
const
char
*
path
=
(
*
env
)
->
GetStringUTFChars
(
env
,
jPath
,
NULL
);
taos_detect_memory_leak
(
path
);
taos_detect_memory_leak
(
path
,
!!
jAutoDump
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
jPath
,
path
);
}
else
{
taos_detect_memory_leak
(
NULL
);
taos_detect_memory_leak
(
NULL
,
!!
jAutoDump
);
}
jniGetGlobalMethod
(
env
);
...
...
src/inc/tutil.h
浏览文件 @
fc6737ab
...
...
@@ -187,7 +187,7 @@ static FORCE_INLINE void taosEncryptPass(uint8_t *inBuf, unsigned int inLen, cha
char
*
taosIpStr
(
uint32_t
ipInt
);
extern
void
taos_detect_memory_leak
(
const
char
*
path
);
extern
void
taos_detect_memory_leak
(
const
char
*
path
,
bool
autoDump
);
extern
void
taos_dump_memory_leak
();
#if TAOS_MEM_CHECK == 1
...
...
src/system/detail/src/dnodeService.c
浏览文件 @
fc6737ab
...
...
@@ -64,9 +64,9 @@ int main(int argc, char *argv[]) {
#if TAOS_MEM_CHECK == 2
}
else
if
(
strcmp
(
argv
[
i
],
"--check-mem-leak"
)
==
0
)
{
if
((
i
<
argc
-
1
)
&&
(
argv
[
i
+
1
][
0
]
!=
'-'
))
{
taos_detect_memory_leak
(
argv
[
++
i
]);
taos_detect_memory_leak
(
argv
[
++
i
]
,
true
);
}
else
{
taos_detect_memory_leak
(
NULL
);
taos_detect_memory_leak
(
NULL
,
true
);
}
#endif
}
...
...
src/util/src/tmem.c
浏览文件 @
fc6737ab
...
...
@@ -307,13 +307,15 @@ void taos_dump_memory_leak() {
static
void
dump_memory_leak_at_sig
(
int
sig
)
{
fprintf
(
fpMemLeak
,
"signal %d received, exiting...
\n
"
,
sig
);
taos_dump_memory_leak
();
struct
sigaction
act
=
{
0
};
act
.
sa_handler
=
SIG_DFL
;
sigaction
(
sig
,
&
act
,
NULL
);
taos_dump_memory_leak
();
}
void
taos_detect_memory_leak
(
const
char
*
path
)
{
void
taos_detect_memory_leak
(
const
char
*
path
,
bool
autoDump
)
{
if
(
fpMemLeak
!=
NULL
)
{
printf
(
"memory leak detection already enabled.
\n
"
);
return
;
...
...
@@ -326,13 +328,14 @@ void taos_detect_memory_leak(const char* path) {
return
;
}
atexit
(
taos_dump_memory_leak
);
struct
sigaction
act
=
{
0
};
act
.
sa_handler
=
dump_memory_leak_at_sig
;
sigaction
(
SIGFPE
,
&
act
,
NULL
);
sigaction
(
SIGSEGV
,
&
act
,
NULL
);
sigaction
(
SIGILL
,
&
act
,
NULL
);
if
(
autoDump
)
{
atexit
(
taos_dump_memory_leak
);
struct
sigaction
act
=
{
0
};
act
.
sa_handler
=
dump_memory_leak_at_sig
;
sigaction
(
SIGFPE
,
&
act
,
NULL
);
sigaction
(
SIGSEGV
,
&
act
,
NULL
);
sigaction
(
SIGILL
,
&
act
,
NULL
);
}
}
#endif
...
...
@@ -342,7 +345,7 @@ void taos_dump_memory_leak() {
// do nothing
}
void
taos_detect_memory_leak
(
const
char
*
path
)
{
void
taos_detect_memory_leak
(
const
char
*
path
,
bool
autoDump
)
{
printf
(
"memory leak detection not enabled, please set 'TAOS_MEM_CHECK' to 2."
);
}
#endif
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录