@@ -154,8 +154,6 @@ const std::string & chdb_streaming_result_error_string(chdb_streaming_result * r
154154
155155chdb_connection * connect_chdb_with_exception (int argc, char ** argv)
156156{
157- CHDB::ChdbMemoryTrackingGuard guard;
158-
159157 try
160158 {
161159 DB::ThreadStatus thread_status;
@@ -189,8 +187,6 @@ chdb_connection * connect_chdb_with_exception(int argc, char ** argv)
189187#if USE_PYTHON
190188void cachePythonTablesFromQuery (chdb_conn * conn, const std::string & query_str)
191189{
192- CHDB::ChdbMemoryTrackingGuard guard;
193-
194190 if (!conn || !conn->server || !conn->connected )
195191 return ;
196192 auto * client = reinterpret_cast <DB::ChdbClient *>(conn->server );
@@ -204,8 +200,6 @@ using namespace CHDB;
204200
205201local_result * query_stable (int argc, char ** argv)
206202{
207- CHDB::ChdbMemoryTrackingGuard guard;
208-
209203 auto query_result = pyEntryClickHouseLocal (argc, argv);
210204 if (!query_result->getError ().empty () || query_result->result_buffer == nullptr )
211205 return nullptr ;
@@ -222,8 +216,6 @@ local_result * query_stable(int argc, char ** argv)
222216
223217void free_result (local_result * result)
224218{
225- CHDB::ChdbMemoryTrackingGuard guard;
226-
227219 if (!result)
228220 {
229221 return ;
@@ -239,8 +231,6 @@ void free_result(local_result * result)
239231
240232local_result_v2 * query_stable_v2 (int argc, char ** argv)
241233{
242- CHDB::ChdbMemoryTrackingGuard guard;
243-
244234 // pyEntryClickHouseLocal may throw some serious exceptions, although it's not likely
245235 // to happen in the context of clickhouse-local. we catch them here and return an error
246236 local_result_v2 * res = nullptr ;
@@ -269,8 +259,6 @@ local_result_v2 * query_stable_v2(int argc, char ** argv)
269259
270260void free_result_v2 (local_result_v2 * result)
271261{
272- CHDB::ChdbMemoryTrackingGuard guard;
273-
274262 if (!result)
275263 return ;
276264
@@ -281,8 +269,6 @@ void free_result_v2(local_result_v2 * result)
281269
282270chdb_conn ** connect_chdb (int argc, char ** argv)
283271{
284- CHDB::ChdbMemoryTrackingGuard guard;
285-
286272 auto * connection = chdb_connect (argc, argv);
287273 if (!connection)
288274 {
@@ -293,8 +279,6 @@ chdb_conn ** connect_chdb(int argc, char ** argv)
293279
294280void close_conn (chdb_conn ** conn)
295281{
296- CHDB::ChdbMemoryTrackingGuard guard;
297-
298282 if (!conn || !*conn)
299283 return ;
300284
@@ -324,8 +308,6 @@ struct local_result_v2 * query_conn(chdb_conn * conn, const char * query, const
324308
325309struct local_result_v2 * query_conn_n (struct chdb_conn * conn, const char * query, size_t query_len, const char * format, size_t format_len)
326310{
327- CHDB::ChdbMemoryTrackingGuard guard;
328-
329311 if (!checkConnectionValidity (conn))
330312 return createErrorLocalResultV2 (" Invalid or closed connection" );
331313
@@ -347,16 +329,12 @@ struct local_result_v2 * query_conn_n(struct chdb_conn * conn, const char * quer
347329
348330chdb_streaming_result * query_conn_streaming (chdb_conn * conn, const char * query, const char * format)
349331{
350- CHDB::ChdbMemoryTrackingGuard guard;
351-
352332 return query_conn_streaming_n (conn, query, query ? std::strlen (query) : 0 , format, format ? std::strlen (format) : 0 );
353333}
354334
355335chdb_streaming_result *
356336query_conn_streaming_n (struct chdb_conn * conn, const char * query, size_t query_len, const char * format, size_t format_len)
357337{
358- CHDB::ChdbMemoryTrackingGuard guard;
359-
360338 if (!checkConnectionValidity (conn))
361339 {
362340 auto * result = new StreamQueryResult (" Invalid or closed connection" );
@@ -391,8 +369,6 @@ query_conn_streaming_n(struct chdb_conn * conn, const char * query, size_t query
391369
392370const char * chdb_streaming_result_error (chdb_streaming_result * result)
393371{
394- CHDB::ChdbMemoryTrackingGuard guard;
395-
396372 if (!result)
397373 return nullptr ;
398374
@@ -407,8 +383,6 @@ const char * chdb_streaming_result_error(chdb_streaming_result * result)
407383
408384local_result_v2 * chdb_streaming_fetch_result (chdb_conn * conn, chdb_streaming_result * result)
409385{
410- CHDB::ChdbMemoryTrackingGuard guard;
411-
412386 if (!checkConnectionValidity (conn))
413387 return createErrorLocalResultV2 (" Invalid or closed connection" );
414388
@@ -438,8 +412,6 @@ local_result_v2 * chdb_streaming_fetch_result(chdb_conn * conn, chdb_streaming_r
438412
439413void chdb_streaming_cancel_query (chdb_conn * conn, chdb_streaming_result * result)
440414{
441- CHDB::ChdbMemoryTrackingGuard guard;
442-
443415 if (!checkConnectionValidity (conn))
444416 return ;
445417
@@ -460,8 +432,6 @@ void chdb_streaming_cancel_query(chdb_conn * conn, chdb_streaming_result * resul
460432
461433void chdb_destroy_result (chdb_streaming_result * result)
462434{
463- CHDB::ChdbMemoryTrackingGuard guard;
464-
465435 if (!result)
466436 return ;
467437
@@ -474,8 +444,6 @@ void chdb_destroy_result(chdb_streaming_result * result)
474444
475445chdb_connection * chdb_connect (int argc, char ** argv)
476446{
477- CHDB::ChdbMemoryTrackingGuard guard;
478-
479447 try
480448 {
481449 return connect_chdb_with_exception (argc, argv);
@@ -505,8 +473,6 @@ chdb_connection * chdb_connect(int argc, char ** argv)
505473
506474void chdb_close_conn (chdb_connection * conn)
507475{
508- CHDB::ChdbMemoryTrackingGuard guard;
509-
510476 if (!conn || !*conn)
511477 return ;
512478
@@ -522,8 +488,6 @@ chdb_result * chdb_query(chdb_connection conn, const char * query, const char *
522488
523489chdb_result * chdb_query_n (chdb_connection conn, const char * query, size_t query_len, const char * format, size_t format_len)
524490{
525- CHDB::ChdbMemoryTrackingGuard guard;
526-
527491 if (!conn)
528492 {
529493 auto * result = new MaterializedQueryResult (" Unexpected null connection" );
@@ -559,8 +523,6 @@ chdb_result * chdb_query_n(chdb_connection conn, const char * query, size_t quer
559523
560524chdb_result * chdb_query_cmdline (int argc, char ** argv)
561525{
562- CHDB::ChdbMemoryTrackingGuard guard;
563-
564526 MaterializedQueryResult * result = nullptr ;
565527 try
566528 {
@@ -587,8 +549,6 @@ chdb_result * chdb_stream_query(chdb_connection conn, const char * query, const
587549
588550chdb_result * chdb_stream_query_n (chdb_connection conn, const char * query, size_t query_len, const char * format, size_t format_len)
589551{
590- CHDB::ChdbMemoryTrackingGuard guard;
591-
592552 if (!conn)
593553 {
594554 auto * result = new StreamQueryResult (" Unexpected null connection" );
@@ -629,8 +589,6 @@ chdb_result * chdb_stream_query_n(chdb_connection conn, const char * query, size
629589
630590chdb_result * chdb_stream_fetch_result (chdb_connection conn, chdb_result * result)
631591{
632- CHDB::ChdbMemoryTrackingGuard guard;
633-
634592 if (!conn)
635593 {
636594 auto * query_result = new MaterializedQueryResult (" Unexpected null connection" );
@@ -676,8 +634,6 @@ chdb_result * chdb_stream_fetch_result(chdb_connection conn, chdb_result * resul
676634
677635void chdb_stream_cancel_query (chdb_connection conn, chdb_result * result)
678636{
679- CHDB::ChdbMemoryTrackingGuard guard;
680-
681637 if (!result || !conn)
682638 return ;
683639
@@ -700,8 +656,6 @@ void chdb_stream_cancel_query(chdb_connection conn, chdb_result * result)
700656
701657void chdb_destroy_query_result (chdb_result * result)
702658{
703- CHDB::ChdbMemoryTrackingGuard guard;
704-
705659 if (!result)
706660 return ;
707661
0 commit comments