未验证 提交 8cdbcb89 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #17762 from taosdata/fix/memReturn

enh: return mem to os
...@@ -36,6 +36,7 @@ void *taosMemoryStrDup(const char *ptr); ...@@ -36,6 +36,7 @@ void *taosMemoryStrDup(const char *ptr);
void taosMemoryFree(void *ptr); void taosMemoryFree(void *ptr);
int64_t taosMemorySize(void *ptr); int64_t taosMemorySize(void *ptr);
void taosPrintBackTrace(); void taosPrintBackTrace();
void taosMemoryTrim(int32_t size);
#define taosMemoryFreeClear(ptr) \ #define taosMemoryFreeClear(ptr) \
do { \ do { \
......
...@@ -20,7 +20,7 @@ static void *dmStatusThreadFp(void *param) { ...@@ -20,7 +20,7 @@ static void *dmStatusThreadFp(void *param) {
SDnodeMgmt *pMgmt = param; SDnodeMgmt *pMgmt = param;
int64_t lastTime = taosGetTimestampMs(); int64_t lastTime = taosGetTimestampMs();
setThreadName("dnode-status"); setThreadName("dnode-status");
while (1) { while (1) {
taosMsleep(200); taosMsleep(200);
if (pMgmt->pData->dropped || pMgmt->pData->stopped) break; if (pMgmt->pData->dropped || pMgmt->pData->stopped) break;
...@@ -28,6 +28,7 @@ static void *dmStatusThreadFp(void *param) { ...@@ -28,6 +28,7 @@ static void *dmStatusThreadFp(void *param) {
int64_t curTime = taosGetTimestampMs(); int64_t curTime = taosGetTimestampMs();
float interval = (curTime - lastTime) / 1000.0f; float interval = (curTime - lastTime) / 1000.0f;
if (interval >= tsStatusInterval) { if (interval >= tsStatusInterval) {
taosMemoryTrim(0);
dmSendStatusReq(pMgmt); dmSendStatusReq(pMgmt);
lastTime = curTime; lastTime = curTime;
} }
......
...@@ -336,3 +336,12 @@ int64_t taosMemorySize(void *ptr) { ...@@ -336,3 +336,12 @@ int64_t taosMemorySize(void *ptr) {
#endif #endif
#endif #endif
} }
void taosMemoryTrim(int32_t size) {
#if defined(WINDOWS) || defined(DARWIN)
// do nothing
return;
#else
malloc_trim(size);
#endif
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册