fix: benchUtil.c delayList free memory leak

This commit is contained in:
Alex Duan 2025-02-03 18:26:27 +08:00
parent f66ca372a2
commit bce692d8d1
6 changed files with 87 additions and 31 deletions

View File

@ -0,0 +1,25 @@
{
"filetype": "query",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "test",
"query_times": 10,
"query_mode": "taosc",
"specified_table_query": {
"threads": 2,
"mixed_query": "yes",
"sqls": [
{
"sql": "select count(*) from test.meters"
},
{
"sql": "select * from test.d0 limit 10"
}
]
}
}

View File

@ -0,0 +1,25 @@
{
"filetype": "query",
"cfgdir": "/etc/taos",
"host": "127.0.0.1",
"port": 6030,
"user": "root",
"password": "taosdata",
"confirm_parameter_prompt": "no",
"continue_if_fail": "yes",
"databases": "test",
"query_times": 10,
"query_mode": "taosc",
"specified_table_query": {
"threads": 2,
"mixed_query": "no",
"sqls": [
{
"sql": "select count(*) from test.meters"
},
{
"sql": "select * from test.d0 limit 10"
}
]
}
}

View File

@ -157,7 +157,7 @@ class TDTestCase(TBase):
# find
taosdump, benchmark, tmpdir = self.findPrograme()
json = "./tools/taosdump/ws3/json/primaryKey.json"
json = "./tools/taosdump/ws/json/primaryKey.json"
# insert data with taosBenchmark
self.insertData(benchmark, json, db)

View File

@ -206,7 +206,7 @@ class TDTestCase(TBase):
# find
taosdump, benchmark, taosadapter, tmpdir = self.findPrograme()
json = "./tools/taosdump/ws3/json/retry.json"
json = "./tools/taosdump/ws/json/retry.json"
# insert data with taosBenchmark
self.insertData(benchmark, json, db)

View File

@ -78,7 +78,7 @@
#
# benchmark 66 cases
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/rest_insert_alltypes_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/rest_insert_alltypes_json.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosdemoTestQueryWithJson-mixed-query.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_sample_csv_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosdemoTestInsertWithJsonStmt-otherPara.py
@ -90,18 +90,18 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt2_insert.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_offset_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/json_tag.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-sml-rest.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-sml-rest.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_auto_create_table_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/insert-json-csv.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert-table-creating-interval.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/insertMix.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert-mix.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosc_insert-mix.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stream_function_test.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/telnet_tcp.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/telnet_tcp.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_sample_csv_json-subtable.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/from-to-continue.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_json_alltypes-interlace.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-retry.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/commandline-retry.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/tmq_case.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/limit_offset_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-sml.py
@ -113,28 +113,28 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/bugs.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_sample_csv_json-subtable.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/query_json-with-error-sqlfile.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert-retry-json-global.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosc_insert-retry-json-global.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/from-to.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/exportCsv.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosdemoTestQueryWithJson.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosdemoTestQueryWithJson.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-partial-col-numpy.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/query_json-with-sqlfile.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/query_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/query_json.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_json_alltypes.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/invalid_commandline.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_json_insert_alltypes-same-min-max.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/default_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_sample_csv_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_sample_csv_json_doesnt_use_ts.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosadapter_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosadapter_json.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/demo.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-supplement-insert.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/custom_col_tag.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/custom_col_tag.py -R
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_auto_create_table_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_insert_alltypes_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stmt_insert_alltypes-same-min-max.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/commandline-vgroups.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert-retry-json-stb.py
,,n,army,python3 ./test.py -f tools/benchmark/basic/taosc_insert-retry-json-stb.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_auto_create_table_json.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/sml_telnet_alltypes.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stream-test.py
@ -143,7 +143,7 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/stt.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/basic/taosc_insert_alltypes_json-partial-col.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/cloud/cloud-test.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/ws/websocket.py
,,y,army,./pytest.sh python3 ./test.py -f tools/benchmark/ws/websocket.py -R
# taosdump 46 cases
,,y,army,./pytest.sh python3 ./test.py -f tools/taosdump/native/taosdumpTest.py
@ -176,22 +176,22 @@
,,y,army,./pytest.sh python3 ./test.py -f tools/taosdump/native/taosdumpTest2.py
,,y,army,./pytest.sh python3 ./test.py -f tools/taosdump/native/taosdumpTestTypeTinyInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeDouble.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedBigInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpEscapedDb.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpPrimaryKey.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeJson.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedSmallInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedTinyInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeSmallInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBigInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBinary.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeFloat.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBool.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpRetry.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeTinyInt.py
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeDouble.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedBigInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpEscapedDb.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpPrimaryKey.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeJson.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedSmallInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedTinyInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeUnsignedInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeSmallInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBigInt.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBinary.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeFloat.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeBool.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpRetry.py -R
,,n,army,python3 ./test.py -f tools/taosdump/ws/taosdumpTestTypeTinyInt.py -R
#
# system test

View File

@ -1110,17 +1110,23 @@ static int32_t benchArrayEnsureCap(BArray* pArray, size_t newCap) {
void* benchArrayAddBatch(BArray* pArray, void* pData, int32_t elems, bool free) {
if (pData == NULL || elems <=0) {
if (free) {
tmfree(pData);
}
return NULL;
}
if (benchArrayEnsureCap(pArray, pArray->size + elems) != 0) {
if (free) {
tmfree(pData);
}
return NULL;
}
void* dst = BARRAY_GET_ELEM(pArray, pArray->size);
memcpy(dst, pData, pArray->elemSize * elems);
if (free) {
tmfree(pData); // TODO remove this
tmfree(pData);
}
pArray->size += elems;
return dst;