Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
6f6fd3e1
T
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
6f6fd3e1
编写于
4月 17, 2023
作者:
dengyihao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix compile error
上级
328687ed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
79 addition
and
76 deletion
+79
-76
include/os/osMemory.h
include/os/osMemory.h
+10
-10
source/libs/stream/src/streamStateRocksdb.c
source/libs/stream/src/streamStateRocksdb.c
+3
-0
source/os/src/osMemory.c
source/os/src/osMemory.c
+66
-66
未找到文件。
include/os/osMemory.h
浏览文件 @
6f6fd3e1
...
...
@@ -36,19 +36,19 @@ extern "C" {
// #endif // ifndef ALLOW_FORBID_FUNC
#endif // if !defined(WINDOWS)
// #define taosMemoryFree malloc
#define taosMemoryMalloc malloc
#define taosMemoryCalloc calloc
#define taosMemoryRealloc realloc
#define taosMemoryFree free
//
//
#define taosMemoryFree malloc
//
#define taosMemoryMalloc malloc
//
#define taosMemoryCalloc calloc
//
#define taosMemoryRealloc realloc
//
#define taosMemoryFree free
int32_t
taosMemoryDbgInit
();
int32_t
taosMemoryDbgInitRestore
();
//
void *taosMemoryMalloc(int64_t size);
//
void *taosMemoryCalloc(int64_t num, int64_t size);
//
void *taosMemoryRealloc(void *ptr, int64_t size);
char
*
taosStrdup
(
const
char
*
ptr
);
//
void taosMemoryFree(void *ptr);
void
*
taosMemoryMalloc
(
int64_t
size
);
void
*
taosMemoryCalloc
(
int64_t
num
,
int64_t
size
);
void
*
taosMemoryRealloc
(
void
*
ptr
,
int64_t
size
);
char
*
taosStrdup
(
const
char
*
ptr
);
void
taosMemoryFree
(
void
*
ptr
);
int64_t
taosMemorySize
(
void
*
ptr
);
void
taosPrintBackTrace
();
void
taosMemoryTrim
(
int32_t
size
);
...
...
source/libs/stream/src/streamStateRocksdb.c
浏览文件 @
6f6fd3e1
...
...
@@ -1040,6 +1040,9 @@ int32_t streamStateGetKVByCur_rocksdb(SStreamStateCur* pCur, SWinKey* pKey, cons
if
(
pKtmp
->
opNum
!=
pCur
->
number
)
{
return
-
1
;
}
size_t
vlen
=
0
;
if
(
pVal
!=
NULL
)
*
pVal
=
(
char
*
)
rocksdb_iter_value
(
pCur
->
iter
,
&
vlen
);
if
(
pVLen
!=
NULL
)
*
pVLen
=
vlen
;
*
pKey
=
pKtmp
->
key
;
return
0
;
}
...
...
source/os/src/osMemory.c
浏览文件 @
6f6fd3e1
...
...
@@ -254,64 +254,64 @@ int32_t taosMemoryDbgInitRestore() {
#endif
}
// void *taosMemoryMalloc(int64_t size) {
// #ifdef USE_TD_MEMORY
// void *tmp = malloc(size + sizeof(TdMemoryInfo));
// if (tmp == NULL) return NULL;
// TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)tmp;
// pTdMemoryInfo->memorySize = size;
// pTdMemoryInfo->symbol = TD_MEMORY_SYMBOL;
// taosBackTrace(pTdMemoryInfo->stackTrace, TD_MEMORY_STACK_TRACE_DEPTH);
// return (char *)tmp + sizeof(TdMemoryInfo);
// #else
// return malloc(size);
// #endif
// }
void
*
taosMemoryMalloc
(
int64_t
size
)
{
#ifdef USE_TD_MEMORY
void
*
tmp
=
malloc
(
size
+
sizeof
(
TdMemoryInfo
));
if
(
tmp
==
NULL
)
return
NULL
;
// void *taosMemoryCalloc(int64_t num, int64_t size) {
// #ifdef USE_TD_MEMORY
// int32_t memorySize = num * size;
// char *tmp = calloc(memorySize + sizeof(TdMemoryInfo), 1);
// if (tmp == NULL) return NULL;
// TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)tmp;
// pTdMemoryInfo->memorySize = memorySize;
// pTdMemoryInfo->symbol = TD_MEMORY_SYMBOL;
// taosBackTrace(pTdMemoryInfo->stackTrace, TD_MEMORY_STACK_TRACE_DEPTH);
// return (char *)tmp + sizeof(TdMemoryInfo);
// #else
// return calloc(num, size);
// #endif
// }
TdMemoryInfoPtr
pTdMemoryInfo
=
(
TdMemoryInfoPtr
)
tmp
;
pTdMemoryInfo
->
memorySize
=
size
;
pTdMemoryInfo
->
symbol
=
TD_MEMORY_SYMBOL
;
taosBackTrace
(
pTdMemoryInfo
->
stackTrace
,
TD_MEMORY_STACK_TRACE_DEPTH
);
// void *taosMemoryRealloc(void *ptr, int64_t size) {
// #ifdef USE_TD_MEMORY
// if (ptr == NULL) return taosMemoryMalloc(size);
return
(
char
*
)
tmp
+
sizeof
(
TdMemoryInfo
);
#else
return
malloc
(
size
);
#endif
}
// TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char *)ptr - sizeof(TdMemoryInfo));
// ASSERT(pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL);
// if (tpTdMemoryInfo->symbol != TD_MEMORY_SYMBOL) {
// +return NULL;
// +
// }
void
*
taosMemoryCalloc
(
int64_t
num
,
int64_t
size
)
{
#ifdef USE_TD_MEMORY
int32_t
memorySize
=
num
*
size
;
char
*
tmp
=
calloc
(
memorySize
+
sizeof
(
TdMemoryInfo
),
1
);
if
(
tmp
==
NULL
)
return
NULL
;
// TdMemoryInfo tdMemoryInfo;
// memcpy(&tdMemoryInfo, pTdMemoryInfo, sizeof(TdMemoryInfo));
TdMemoryInfoPtr
pTdMemoryInfo
=
(
TdMemoryInfoPtr
)
tmp
;
pTdMemoryInfo
->
memorySize
=
memorySize
;
pTdMemoryInfo
->
symbol
=
TD_MEMORY_SYMBOL
;
taosBackTrace
(
pTdMemoryInfo
->
stackTrace
,
TD_MEMORY_STACK_TRACE_DEPTH
);
// void *tmp = realloc(pTdMemoryInfo, size + sizeof(TdMemoryInfo));
// if (tmp == NULL) return NULL;
return
(
char
*
)
tmp
+
sizeof
(
TdMemoryInfo
);
#else
return
calloc
(
num
,
size
);
#endif
}
// memcpy(tmp, &tdMemoryInfo, sizeof(TdMemoryInfo));
// ((TdMemoryInfoPtr)tmp)->memorySize = size;
void
*
taosMemoryRealloc
(
void
*
ptr
,
int64_t
size
)
{
#ifdef USE_TD_MEMORY
if
(
ptr
==
NULL
)
return
taosMemoryMalloc
(
size
);
// return (char *)tmp + sizeof(TdMemoryInfo);
// #else
// return realloc(ptr, size);
// #endif
// }
TdMemoryInfoPtr
pTdMemoryInfo
=
(
TdMemoryInfoPtr
)((
char
*
)
ptr
-
sizeof
(
TdMemoryInfo
));
ASSERT
(
pTdMemoryInfo
->
symbol
==
TD_MEMORY_SYMBOL
);
if
(
tpTdMemoryInfo
->
symbol
!=
TD_MEMORY_SYMBOL
)
{
+
return
NULL
;
+
}
TdMemoryInfo
tdMemoryInfo
;
memcpy
(
&
tdMemoryInfo
,
pTdMemoryInfo
,
sizeof
(
TdMemoryInfo
));
void
*
tmp
=
realloc
(
pTdMemoryInfo
,
size
+
sizeof
(
TdMemoryInfo
));
if
(
tmp
==
NULL
)
return
NULL
;
memcpy
(
tmp
,
&
tdMemoryInfo
,
sizeof
(
TdMemoryInfo
));
((
TdMemoryInfoPtr
)
tmp
)
->
memorySize
=
size
;
return
(
char
*
)
tmp
+
sizeof
(
TdMemoryInfo
);
#else
return
realloc
(
ptr
,
size
);
#endif
}
char
*
taosStrdup
(
const
char
*
ptr
)
{
#ifdef USE_TD_MEMORY
...
...
@@ -334,21 +334,21 @@ char *taosStrdup(const char *ptr) {
#endif
}
//
void taosMemoryFree(void *ptr) {
//
if (NULL == ptr) return;
//
#ifdef USE_TD_MEMORY
//
TdMemoryInfoPtr pTdMemoryInfo = (TdMemoryInfoPtr)((char *)ptr - sizeof(TdMemoryInfo));
//
if (pTdMemoryInfo->symbol == TD_MEMORY_SYMBOL) {
//
pTdMemoryInfo->memorySize = 0;
//
// memset(pTdMemoryInfo, 0, sizeof(TdMemoryInfo));
//
free(pTdMemoryInfo);
//
} else {
//
free(ptr);
//
}
//
#else
//
return free(ptr);
//
#endif
//
}
void
taosMemoryFree
(
void
*
ptr
)
{
if
(
NULL
==
ptr
)
return
;
#ifdef USE_TD_MEMORY
TdMemoryInfoPtr
pTdMemoryInfo
=
(
TdMemoryInfoPtr
)((
char
*
)
ptr
-
sizeof
(
TdMemoryInfo
));
if
(
pTdMemoryInfo
->
symbol
==
TD_MEMORY_SYMBOL
)
{
pTdMemoryInfo
->
memorySize
=
0
;
// memset(pTdMemoryInfo, 0, sizeof(TdMemoryInfo));
free
(
pTdMemoryInfo
);
}
else
{
free
(
ptr
);
}
#else
return
free
(
ptr
);
#endif
}
int64_t
taosMemorySize
(
void
*
ptr
)
{
if
(
ptr
==
NULL
)
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录