修复统计、布尔表达式运算、单元测试模块中的内存泄漏。
This commit is contained in:
@@ -594,7 +594,6 @@ int Maat_set_feather_opt(Maat_feather_t feather,enum MAAT_INIT_OPT type,const vo
|
||||
break;
|
||||
case MAAT_OPT_STAT_ON:
|
||||
_feather->stat_on=1;
|
||||
_feather->stat_handle=FS_create_handle();
|
||||
break;
|
||||
case MAAT_OPT_PERF_ON:
|
||||
_feather->perf_on=1;
|
||||
@@ -794,7 +793,7 @@ int Maat_initiate_feather(Maat_feather_t feather)
|
||||
if(_feather->stat_on==1)
|
||||
{
|
||||
MESA_handle_runtime_log(_feather->logger,RLOG_LV_FATAL,maat_module ,
|
||||
"At initiation: MAAT_OPT_STAT_FILE_PATH not set,TURN OFF STAT trigger.");
|
||||
"At initiation: MAAT_OPT_STAT_FILE_PATH not set, TURN OFF STAT trigger.");
|
||||
}
|
||||
_feather->stat_on=0;
|
||||
}
|
||||
@@ -810,9 +809,10 @@ int Maat_initiate_feather(Maat_feather_t feather)
|
||||
"Update with cumulative version OFF.");
|
||||
}
|
||||
|
||||
|
||||
maat_stat_init(_feather);
|
||||
|
||||
if(_feather->stat_on==1)
|
||||
{
|
||||
maat_stat_init(_feather);
|
||||
}
|
||||
|
||||
pthread_create(&(_feather->cfg_mon_t), NULL, thread_rule_monitor, (void*)_feather);
|
||||
return 0;
|
||||
@@ -1699,12 +1699,6 @@ stream_para_t Maat_stream_scan_digest_start(Maat_feather_t feather,int table_id,
|
||||
_feather->scan_err_cnt++;
|
||||
return NULL;
|
||||
}
|
||||
tmp_fuzzy_handle=SFH_instance(total_len);
|
||||
if(tmp_fuzzy_handle==NULL)
|
||||
{
|
||||
_feather->scan_err_cnt++;
|
||||
return NULL;
|
||||
}
|
||||
struct _stream_para_t* sp=(struct _stream_para_t*)calloc(sizeof(struct _stream_para_t),1);
|
||||
scanner=_feather->scanner;
|
||||
sp->feather=_feather;
|
||||
@@ -1713,8 +1707,15 @@ stream_para_t Maat_stream_scan_digest_start(Maat_feather_t feather,int table_id,
|
||||
if(scanner==NULL)
|
||||
{
|
||||
return sp;
|
||||
}
|
||||
tmp_fuzzy_handle=SFH_instance(total_len);
|
||||
if(tmp_fuzzy_handle==NULL)
|
||||
{
|
||||
_feather->scan_err_cnt++;
|
||||
return NULL;
|
||||
}
|
||||
INC_SCANNER_REF(scanner, thread_num);
|
||||
|
||||
sp->table_id=table_id;
|
||||
sp->thread_num=thread_num;
|
||||
sp->total_len=total_len;
|
||||
|
||||
@@ -3549,6 +3549,7 @@ void *thread_rule_monitor(void *arg)
|
||||
MESA_htable_destroy(feather->map_tablename2id,free);
|
||||
destroy_maat_scanner(feather->scanner);
|
||||
garbage_bury(feather->garbage_q,0,feather->logger);
|
||||
assert(0==MESA_lqueue_get_count(feather->garbage_q));
|
||||
MESA_lqueue_destroy(feather->garbage_q,lqueue_destroy_cb,NULL);
|
||||
int i=0;
|
||||
for(i=0;i<MAX_TABLE_NUM;i++)
|
||||
|
||||
@@ -51,6 +51,8 @@ void maat_stat_init(struct _Maat_feather_t* feather)
|
||||
FS_set_para(feather->stat_handle, PRINT_MODE, &value, sizeof(value));
|
||||
value=0;
|
||||
FS_set_para(feather->stat_handle, CREATE_THREAD, &value, sizeof(value));
|
||||
|
||||
FS_set_para(feather->stat_handle, APP_NAME, feather->instance_name, strlen(feather->instance_name)+1);
|
||||
|
||||
feather->fs_status_id[STATUS_VERSION]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"version");
|
||||
feather->fs_status_id[STATUS_THRED_NUM]=FS_register(feather->stat_handle, FS_STYLE_STATUS, FS_CALC_CURRENT,"thread");
|
||||
|
||||
@@ -252,6 +252,7 @@ void boolexpr_destroy(void * instance)
|
||||
for(unsigned int i=0; i<matcher->max_thread_num; i++)
|
||||
{
|
||||
delete [] matcher->thread_data[i].bitmap;
|
||||
delete [] matcher->thread_data[i].matched_bitmap;
|
||||
}
|
||||
delete [] matcher->thread_data;
|
||||
delete matcher;
|
||||
|
||||
@@ -323,7 +323,7 @@ int test_digest_scan(Maat_feather_t feather,const char* table_name,const char* f
|
||||
{
|
||||
printf("fopen %s error.\n",file_name);
|
||||
}
|
||||
Maat_stream_scan_string_end(&sp);
|
||||
Maat_stream_scan_digest_end(&sp);
|
||||
return ret;
|
||||
}
|
||||
int test_plugin_table(Maat_feather_t feather,const char* table_name,
|
||||
|
||||
@@ -235,7 +235,7 @@ TEST(DigestScan, Pure)
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
Maat_stream_scan_string_end(&sp);
|
||||
Maat_stream_scan_digest_end(&sp);
|
||||
EXPECT_GE(hit_cnt, 1);
|
||||
Maat_clean_status(&mid);
|
||||
return;
|
||||
@@ -772,7 +772,7 @@ protected:
|
||||
static void *logger;
|
||||
};
|
||||
Maat_feather_t MaatFileTest::_shared_feather_f;
|
||||
Maat_feather_t MaatFileTest::logger;
|
||||
void* MaatFileTest::logger;
|
||||
|
||||
TEST_F(MaatFileTest, StreamFiles)
|
||||
{
|
||||
@@ -853,7 +853,6 @@ protected:
|
||||
|
||||
static void SetUpTestCase()
|
||||
{
|
||||
void *logger=NULL;
|
||||
logger=MESA_create_runtime_log_handle("test_maat_redis.log",0);
|
||||
|
||||
_shared_feather=Maat_feather(g_iThreadNum, table_info_path, logger);
|
||||
@@ -876,13 +875,17 @@ protected:
|
||||
static void TearDownTestCase()
|
||||
{
|
||||
Maat_burn_feather(_shared_feather);
|
||||
MESA_destroy_runtime_log_handle(logger);
|
||||
|
||||
}
|
||||
// Some expensive resource shared by all tests.
|
||||
static Maat_feather_t _shared_feather;
|
||||
static Maat_feather_t _shared_feather;
|
||||
static void *logger;
|
||||
static int linger_timeout;
|
||||
};
|
||||
Maat_feather_t MaatCmdTest::_shared_feather;
|
||||
void* MaatCmdTest::logger;
|
||||
|
||||
int MaatCmdTest::linger_timeout;
|
||||
int test_add_expr_command(Maat_feather_t feather,const char* region_table,int config_id, int timeout,int label_id, const char* keywords)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user