diff options
| author | Qiuwen Lu <[email protected]> | 2017-09-26 10:27:21 +0800 |
|---|---|---|
| committer | Qiuwen Lu <[email protected]> | 2017-09-26 10:27:21 +0800 |
| commit | 673f2560c35d37bf89177651e0eee3a1c31c9006 (patch) | |
| tree | 42f9af65fd9d94bd8c4f8738c3db346c9691340b | |
| parent | dfb1af001234bc350d1a75701c31838dd3bedb6e (diff) | |
修正monit线程中没有释放cJSON结构体的Bug。v4.2.22-20170926
- 原实现在monit线程中没有释放用于状态监测的cJSON结构体。导致每秒泄露XXX字节内存。
- 现改为用cJSON_Delete函数析构cJSON对象。
| -rw-r--r-- | app/src/monit.c | 2 | ||||
| -rw-r--r-- | service/src/core.c | 7 | ||||
| -rw-r--r-- | service/src/monit.c | 2 | ||||
| -rw-r--r-- | tunnat/src/monit.cc | 2 |
4 files changed, 9 insertions, 4 deletions
diff --git a/app/src/monit.c b/app/src/monit.c index fb8fdeb..e1a791f 100644 --- a/app/src/monit.c +++ b/app/src/monit.c @@ -261,7 +261,7 @@ int mrapp_monit_loop(struct mr_instance * instance) } fprintf(fp_monit, "%s", str_json_print); - free(j_root); + cJSON_Delete(j_root); fclose(fp_monit); return 0; }
\ No newline at end of file diff --git a/service/src/core.c b/service/src/core.c index 87180ae..dc9f98b 100644 --- a/service/src/core.c +++ b/service/src/core.c @@ -343,8 +343,13 @@ static void sc_eal_init(struct sc_main * sc, const char * cmd) } MR_INFO("EAL Parameters: %s", str_eal_cmdline); + ret = rte_eal_init(eal_argc, eal_argv); - MR_VERIFY_2(ret >= 0, "Cannot init EAL Enviorment, Failed"); + if (ret < 0) + { + MR_ERROR("Cannot init EAL Environment, Failed."); + exit(EXIT_FAILURE); + } /* After EAL, copy some parameters to sc_main */ unsigned int lcore_id = 0; diff --git a/service/src/monit.c b/service/src/monit.c index 620191c..75d06e0 100644 --- a/service/src/monit.c +++ b/service/src/monit.c @@ -277,7 +277,7 @@ int sc_monit_loop(struct sc_main * sc) fprintf(fp_monit, "%s", str_json_print); fclose(fp_monit); - free(j_root); + cJSON_Delete(j_root); return 0; }
\ No newline at end of file diff --git a/tunnat/src/monit.cc b/tunnat/src/monit.cc index e89ef96..6caed91 100644 --- a/tunnat/src/monit.cc +++ b/tunnat/src/monit.cc @@ -95,7 +95,7 @@ int tunnat_monit_loop(TunnatInstance * instance) cJSON * j_root = monit_root(instance); char * str_json_print = cJSON_Print(j_root); fprintf(fp_monit, "%s", str_json_print); - free(j_root); + cJSON_Delete(j_root); fclose(fp_monit); return 0; } |
