Skip to content

[Fix](geo) fix memory leak in geo#58004

Merged
zclllyybb merged 6 commits intoapache:masterfrom
linrrzqqq:geo-fix
Nov 25, 2025
Merged

[Fix](geo) fix memory leak in geo#58004
zclllyybb merged 6 commits intoapache:masterfrom
linrrzqqq:geo-fix

Conversation

@linrrzqqq
Copy link
Contributor

@linrrzqqq linrrzqqq commented Nov 13, 2025

What problem does this PR solve?

Issue Number: close #xxx

Related PR: #xxx

Problem Summary:

The current WkbParse::parse_wkb function has a memory leak issue caused by unreleased pointers, the pseudocode is as follows:

struct WktContext {
    Shape* shape;
    Status parse_status;
};

void init (WktContext& ctx) {
    ctx.shape = (Shape*) malloc(sizeof(Shape));
    ctx.parse_status == GEO_PARSE_OK;
}

void parse_wkt(Shape** to_shape) {
    WktContext ctx;
    init(ctx);

    auto status = wkt_parse();
    if (status == GEO_PARSE_OK) {
        *to_shape = ctx.shape;
    } else {
        ctx.parse_status = GEO_PARSE_ERROR;
        // Here ctx.shape is not deleted, leading to memory leak
    }
}

This PR replaces some raw pointers in geo with unique_ptr to enhance memory management safety and reduce potential memory leaks issues.

Release note

None

Check List (For Author)

  • Test

    • Regression test
    • Unit Test
    • Manual test (add detailed scripts or steps below)
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@linrrzqqq linrrzqqq force-pushed the geo-fix branch 5 times, most recently from 8869b00 to 057970e Compare November 13, 2025 16:00
@linrrzqqq
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 34373 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 057970e4756bb5f297653b33f6f4c13bd38d49c9, data reload: false

------ Round 1 ----------------------------------
q1	17622	5097	5019	5019
q2	2032	327	222	222
q3	10211	1322	720	720
q4	10259	938	380	380
q5	7504	2366	2379	2366
q6	190	172	138	138
q7	877	772	626	626
q8	9346	1315	1073	1073
q9	6864	5140	5129	5129
q10	6819	2237	1812	1812
q11	503	308	268	268
q12	334	375	225	225
q13	17755	3635	3008	3008
q14	232	234	212	212
q15	576	512	507	507
q16	1026	994	939	939
q17	588	855	400	400
q18	7784	7170	7134	7134
q19	1098	942	587	587
q20	359	338	239	239
q21	3911	3244	2379	2379
q22	1090	1038	990	990
Total cold run time: 106980 ms
Total hot run time: 34373 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5096	5076	5091	5076
q2	255	335	232	232
q3	2139	2696	2280	2280
q4	1417	1806	1372	1372
q5	4242	4509	4645	4509
q6	233	180	132	132
q7	2112	2013	1810	1810
q8	2610	2627	2596	2596
q9	7456	7341	7356	7341
q10	3027	3336	2895	2895
q11	612	521	516	516
q12	846	768	614	614
q13	3484	4219	3334	3334
q14	309	292	276	276
q15	537	525	526	525
q16	1072	1111	1054	1054
q17	1197	1601	1371	1371
q18	8102	7697	7569	7569
q19	836	839	865	839
q20	2000	2049	1912	1912
q21	5090	4377	4281	4281
q22	1100	1049	1006	1006
Total cold run time: 53772 ms
Total hot run time: 51540 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187388 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 057970e4756bb5f297653b33f6f4c13bd38d49c9, data reload: false

query1	1038	405	396	396
query2	6562	1726	1739	1726
query3	6748	229	234	229
query4	26669	23325	22952	22952
query5	4445	653	476	476
query6	350	241	229	229
query7	4654	493	306	306
query8	299	266	253	253
query9	8734	2595	2633	2595
query10	514	347	301	301
query11	15904	15291	14792	14792
query12	196	114	110	110
query13	1683	558	433	433
query14	11958	9323	9236	9236
query15	201	188	175	175
query16	7684	676	515	515
query17	1354	742	610	610
query18	2023	406	309	309
query19	205	202	170	170
query20	130	124	119	119
query21	216	132	110	110
query22	3856	3985	3911	3911
query23	33964	33114	32859	32859
query24	8284	2395	2416	2395
query25	635	554	477	477
query26	1238	275	164	164
query27	2751	503	352	352
query28	4351	2244	2214	2214
query29	835	630	530	530
query30	300	232	197	197
query31	927	811	731	731
query32	95	86	86	86
query33	626	393	345	345
query34	791	860	520	520
query35	807	848	753	753
query36	986	1002	914	914
query37	132	119	91	91
query38	3491	3539	3425	3425
query39	1489	1468	1409	1409
query40	233	132	123	123
query41	69	77	66	66
query42	135	114	114	114
query43	487	507	482	482
query44	1240	754	742	742
query45	196	188	174	174
query46	878	998	642	642
query47	1779	1787	1742	1742
query48	401	430	320	320
query49	792	520	440	440
query50	644	678	415	415
query51	3933	4023	3922	3922
query52	107	113	103	103
query53	254	270	207	207
query54	328	318	298	298
query55	87	91	86	86
query56	349	336	350	336
query57	1177	1167	1109	1109
query58	289	278	262	262
query59	2595	2638	2517	2517
query60	348	348	322	322
query61	159	158	152	152
query62	779	705	654	654
query63	231	192	195	192
query64	4450	1141	847	847
query65	4026	3968	3939	3939
query66	1082	436	332	332
query67	15369	15081	14902	14902
query68	8508	951	596	596
query69	486	315	286	286
query70	1342	1326	1286	1286
query71	511	351	314	314
query72	6143	4968	4924	4924
query73	684	598	363	363
query74	9177	9124	8792	8792
query75	4004	3331	2830	2830
query76	3807	1165	775	775
query77	823	398	307	307
query78	9490	9602	8865	8865
query79	2905	846	609	609
query80	705	591	524	524
query81	493	265	229	229
query82	462	158	137	137
query83	292	263	259	259
query84	295	124	96	96
query85	905	482	461	461
query86	348	328	286	286
query87	3769	3779	3620	3620
query88	3355	2256	2273	2256
query89	420	333	303	303
query90	2064	229	230	229
query91	165	166	136	136
query92	83	71	67	67
query93	2098	983	644	644
query94	702	436	351	351
query95	410	313	315	313
query96	484	572	281	281
query97	2962	3022	2915	2915
query98	246	219	212	212
query99	1470	1387	1267	1267
Total cold run time: 279150 ms
Total hot run time: 187388 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 28.04 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 057970e4756bb5f297653b33f6f4c13bd38d49c9, data reload: false

query1	0.05	0.05	0.05
query2	0.09	0.05	0.05
query3	0.26	0.08	0.08
query4	1.61	0.11	0.10
query5	0.26	0.24	0.25
query6	1.16	0.64	0.62
query7	0.03	0.03	0.02
query8	0.06	0.04	0.04
query9	0.57	0.53	0.52
query10	0.58	0.58	0.58
query11	0.16	0.10	0.11
query12	0.15	0.12	0.12
query13	0.62	0.60	0.60
query14	1.00	1.00	0.99
query15	0.84	0.84	0.83
query16	0.39	0.38	0.39
query17	1.01	1.02	0.99
query18	0.22	0.20	0.20
query19	1.93	1.80	1.78
query20	0.01	0.01	0.02
query21	15.45	0.21	0.13
query22	5.05	0.07	0.05
query23	15.66	0.26	0.11
query24	3.01	0.93	1.00
query25	0.09	0.07	0.05
query26	0.14	0.13	0.13
query27	0.07	0.06	0.06
query28	5.26	1.14	0.93
query29	12.58	3.90	3.30
query30	0.28	0.14	0.12
query31	2.81	0.60	0.38
query32	3.23	0.56	0.49
query33	2.99	3.09	3.04
query34	15.91	5.15	4.55
query35	4.58	4.64	4.61
query36	0.67	0.50	0.50
query37	0.10	0.07	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.02
query40	0.17	0.14	0.14
query41	0.09	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.03	0.03
Total cold run time: 99.33 s
Total hot run time: 28.04 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 17.65% (12/68) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.81% (18284/34621)
Line Coverage 38.19% (166272/435436)
Region Coverage 33.16% (129200/389575)
Branch Coverage 33.91% (55464/163568)

@linrrzqqq linrrzqqq changed the title [test] [Fix](geo) fix memory leak in geo Nov 14, 2025
@linrrzqqq
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 34271 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 28be779e69c0bd28438755b800d0ee1f9d6ce580, data reload: false

------ Round 1 ----------------------------------
q1	17626	5269	5040	5040
q2	2047	346	209	209
q3	10205	1340	719	719
q4	10238	985	381	381
q5	7506	2227	2341	2227
q6	187	170	136	136
q7	886	800	628	628
q8	9347	1281	1301	1281
q9	6969	5180	5230	5180
q10	6869	2200	1827	1827
q11	499	289	279	279
q12	340	364	230	230
q13	17792	3663	3024	3024
q14	228	237	208	208
q15	585	510	499	499
q16	981	1001	925	925
q17	591	873	366	366
q18	7499	7208	7044	7044
q19	1082	965	558	558
q20	360	332	239	239
q21	3658	3772	2300	2300
q22	1053	1039	971	971
Total cold run time: 106548 ms
Total hot run time: 34271 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5128	5134	5142	5134
q2	251	315	242	242
q3	2138	2674	2305	2305
q4	1339	1750	1283	1283
q5	4217	4464	4649	4464
q6	217	172	134	134
q7	2090	1988	1846	1846
q8	2616	2599	2615	2599
q9	7474	7366	7399	7366
q10	2999	3261	2891	2891
q11	587	536	483	483
q12	705	807	629	629
q13	3677	3972	3327	3327
q14	297	300	275	275
q15	541	527	501	501
q16	1105	1118	1074	1074
q17	1177	1599	1364	1364
q18	7820	7690	7753	7690
q19	860	796	869	796
q20	1968	2102	1916	1916
q21	4952	4328	4246	4246
q22	1084	1051	998	998
Total cold run time: 53242 ms
Total hot run time: 51563 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 187777 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 28be779e69c0bd28438755b800d0ee1f9d6ce580, data reload: false

query1	1040	424	395	395
query2	6550	1729	1647	1647
query3	6758	226	229	226
query4	26665	23421	23595	23421
query5	4387	638	490	490
query6	332	247	229	229
query7	4649	516	301	301
query8	298	258	244	244
query9	8712	2592	2595	2592
query10	496	333	304	304
query11	15780	15069	14793	14793
query12	181	120	110	110
query13	1675	550	426	426
query14	10300	9078	9173	9078
query15	210	189	174	174
query16	7154	677	495	495
query17	972	743	603	603
query18	2021	416	328	328
query19	209	198	174	174
query20	137	125	125	125
query21	219	137	113	113
query22	4028	4053	4036	4036
query23	33634	33010	33105	33010
query24	8430	2421	2399	2399
query25	592	504	458	458
query26	1244	273	154	154
query27	2767	503	350	350
query28	4423	2215	2193	2193
query29	880	612	478	478
query30	294	226	199	199
query31	896	788	714	714
query32	85	79	76	76
query33	599	383	319	319
query34	800	857	524	524
query35	816	838	738	738
query36	966	959	912	912
query37	133	113	89	89
query38	3570	3488	3447	3447
query39	1473	1433	1416	1416
query40	224	129	115	115
query41	65	62	62	62
query42	131	118	112	112
query43	490	497	467	467
query44	1250	756	754	754
query45	204	181	174	174
query46	888	994	650	650
query47	1718	1822	1703	1703
query48	394	458	324	324
query49	796	507	401	401
query50	681	698	416	416
query51	3853	3872	3928	3872
query52	109	112	100	100
query53	237	269	200	200
query54	336	320	298	298
query55	92	90	86	86
query56	366	348	325	325
query57	1178	1213	1114	1114
query58	299	281	284	281
query59	2506	2767	2666	2666
query60	363	375	352	352
query61	196	194	198	194
query62	815	734	682	682
query63	231	193	195	193
query64	4665	1277	1023	1023
query65	4007	3933	3958	3933
query66	1188	472	359	359
query67	15437	14992	14728	14728
query68	8151	930	597	597
query69	506	331	296	296
query70	1304	1335	1293	1293
query71	450	346	320	320
query72	6164	4933	4921	4921
query73	643	590	363	363
query74	8813	9084	8791	8791
query75	3472	3316	2780	2780
query76	3364	1160	727	727
query77	688	408	322	322
query78	9545	9747	8836	8836
query79	2505	847	592	592
query80	718	585	536	536
query81	510	262	234	234
query82	265	155	130	130
query83	275	260	251	251
query84	298	117	95	95
query85	944	496	450	450
query86	377	316	295	295
query87	3689	3734	3595	3595
query88	3796	2271	2277	2271
query89	385	329	296	296
query90	1906	227	226	226
query91	168	170	153	153
query92	81	73	64	64
query93	2209	990	639	639
query94	710	453	334	334
query95	406	331	308	308
query96	494	603	281	281
query97	2898	2959	2877	2877
query98	245	221	204	204
query99	1359	1413	1336	1336
Total cold run time: 274432 ms
Total hot run time: 187777 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 27.58 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 28be779e69c0bd28438755b800d0ee1f9d6ce580, data reload: false

query1	0.05	0.05	0.05
query2	0.09	0.05	0.05
query3	0.26	0.08	0.08
query4	1.62	0.11	0.11
query5	0.26	0.25	0.25
query6	1.17	0.65	0.65
query7	0.04	0.03	0.02
query8	0.05	0.04	0.04
query9	0.58	0.54	0.51
query10	0.58	0.57	0.57
query11	0.17	0.12	0.11
query12	0.15	0.11	0.12
query13	0.62	0.59	0.60
query14	0.98	1.01	1.00
query15	0.85	0.83	0.83
query16	0.39	0.40	0.38
query17	0.99	1.04	1.02
query18	0.22	0.19	0.20
query19	1.91	1.82	1.79
query20	0.01	0.01	0.01
query21	15.43	0.17	0.12
query22	5.11	0.07	0.04
query23	15.65	0.26	0.10
query24	3.28	0.62	0.78
query25	0.09	0.06	0.05
query26	0.15	0.13	0.13
query27	0.07	0.05	0.05
query28	5.36	1.12	0.94
query29	12.64	3.89	3.28
query30	0.30	0.14	0.12
query31	2.82	0.58	0.38
query32	3.24	0.54	0.48
query33	3.04	3.03	3.10
query34	15.98	5.18	4.50
query35	4.55	4.58	4.54
query36	0.67	0.50	0.48
query37	0.10	0.07	0.07
query38	0.07	0.04	0.04
query39	0.03	0.03	0.04
query40	0.17	0.15	0.13
query41	0.08	0.04	0.03
query42	0.04	0.03	0.03
query43	0.04	0.03	0.03
Total cold run time: 99.9 s
Total hot run time: 27.58 s

@hello-stephen
Copy link
Contributor

BE UT Coverage Report

Increment line coverage 17.91% (12/67) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.81% (18284/34621)
Line Coverage 38.18% (166261/435444)
Region Coverage 33.19% (129288/389588)
Branch Coverage 33.90% (55460/163580)

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 80.60% (54/67) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.56% (24347/34021)
Line Coverage 58.04% (253112/436118)
Region Coverage 53.41% (211025/395099)
Branch Coverage 54.67% (90017/164655)

@linrrzqqq linrrzqqq marked this pull request as ready for review November 14, 2025 08:08
@zclllyybb zclllyybb self-assigned this Nov 14, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just make them return uptr and move it

@linrrzqqq
Copy link
Contributor Author

run buildall

@doris-robot
Copy link

TPC-H: Total hot run time: 34108 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 21364f9a145c772304a1afb0ad30291984ffbc44, data reload: false

------ Round 1 ----------------------------------
q1	17618	5090	5039	5039
q2	2023	314	217	217
q3	10282	1295	711	711
q4	10224	870	356	356
q5	7543	2426	2274	2274
q6	184	175	137	137
q7	924	758	631	631
q8	9334	1381	1100	1100
q9	6929	5185	5130	5130
q10	6876	2234	1800	1800
q11	510	305	279	279
q12	342	362	227	227
q13	17773	3637	3043	3043
q14	227	230	213	213
q15	584	509	507	507
q16	1019	987	933	933
q17	578	853	385	385
q18	7383	7089	7053	7053
q19	1100	943	557	557
q20	353	346	226	226
q21	3702	3215	2296	2296
q22	1076	1031	994	994
Total cold run time: 106584 ms
Total hot run time: 34108 ms

----- Round 2, with runtime_filter_mode=off -----
q1	5083	5063	5046	5046
q2	251	322	245	245
q3	2157	2679	2289	2289
q4	1339	1752	1339	1339
q5	4208	4324	4435	4324
q6	230	176	134	134
q7	2094	2002	1810	1810
q8	2673	2672	2603	2603
q9	7446	7384	7203	7203
q10	3039	3232	2848	2848
q11	569	550	503	503
q12	688	767	653	653
q13	3801	3840	3351	3351
q14	301	298	274	274
q15	538	520	494	494
q16	1084	1087	1064	1064
q17	1189	1623	1379	1379
q18	7881	7811	7520	7520
q19	867	839	1017	839
q20	1991	1988	1778	1778
q21	4695	4242	4336	4242
q22	1084	1068	1026	1026
Total cold run time: 53208 ms
Total hot run time: 50964 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 188810 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 21364f9a145c772304a1afb0ad30291984ffbc44, data reload: false

query1	1032	402	391	391
query2	6604	1700	1652	1652
query3	6761	241	230	230
query4	26585	23539	23388	23388
query5	4425	647	521	521
query6	340	246	226	226
query7	4636	499	306	306
query8	299	259	241	241
query9	8701	2920	2921	2920
query10	504	353	301	301
query11	15836	15014	14768	14768
query12	188	155	119	119
query13	1674	552	437	437
query14	10400	9195	9143	9143
query15	196	187	176	176
query16	7192	651	505	505
query17	1234	758	626	626
query18	1989	453	336	336
query19	252	203	179	179
query20	130	128	123	123
query21	221	131	117	117
query22	4067	4251	4185	4185
query23	33810	32905	32942	32905
query24	8180	2357	2415	2357
query25	640	521	463	463
query26	1266	272	167	167
query27	2769	495	407	407
query28	4406	2234	2203	2203
query29	847	660	502	502
query30	291	233	200	200
query31	890	809	717	717
query32	94	82	80	80
query33	594	386	350	350
query34	796	857	535	535
query35	822	857	745	745
query36	965	1000	898	898
query37	130	119	101	101
query38	3499	3502	3487	3487
query39	1494	1404	1401	1401
query40	233	137	126	126
query41	64	61	67	61
query42	140	119	116	116
query43	485	498	463	463
query44	1246	796	772	772
query45	189	186	173	173
query46	883	1010	649	649
query47	1766	1796	1735	1735
query48	400	429	323	323
query49	776	511	421	421
query50	650	679	409	409
query51	3902	4000	3873	3873
query52	114	110	108	108
query53	235	271	203	203
query54	331	321	300	300
query55	100	97	89	89
query56	363	365	382	365
query57	1170	1189	1133	1133
query58	310	310	322	310
query59	2514	2712	2467	2467
query60	376	386	363	363
query61	192	192	189	189
query62	794	725	695	695
query63	240	203	206	203
query64	4727	1318	1012	1012
query65	4044	3928	3998	3928
query66	1207	470	370	370
query67	15441	14979	14841	14841
query68	7263	928	602	602
query69	519	349	316	316
query70	1321	1292	1250	1250
query71	440	350	342	342
query72	6091	4960	4915	4915
query73	647	586	369	369
query74	8992	9236	8879	8879
query75	3265	3218	2768	2768
query76	3225	1166	755	755
query77	513	407	344	344
query78	9615	9885	8931	8931
query79	2166	831	590	590
query80	703	595	541	541
query81	519	263	231	231
query82	218	160	135	135
query83	266	268	250	250
query84	255	116	93	93
query85	947	512	458	458
query86	391	310	317	310
query87	3677	3632	3597	3597
query88	2869	2291	2307	2291
query89	391	338	296	296
query90	2009	240	233	233
query91	169	177	139	139
query92	95	82	77	77
query93	1702	1015	657	657
query94	738	436	336	336
query95	409	355	334	334
query96	487	600	286	286
query97	2899	2955	2847	2847
query98	245	217	215	215
query99	1354	1406	1318	1318
Total cold run time: 272051 ms
Total hot run time: 188810 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 27.79 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 21364f9a145c772304a1afb0ad30291984ffbc44, data reload: false

query1	0.06	0.06	0.05
query2	0.09	0.06	0.05
query3	0.26	0.08	0.08
query4	1.61	0.11	0.11
query5	0.27	0.25	0.26
query6	1.20	0.63	0.65
query7	0.03	0.03	0.03
query8	0.06	0.04	0.05
query9	0.57	0.54	0.51
query10	0.58	0.58	0.58
query11	0.16	0.11	0.12
query12	0.15	0.12	0.12
query13	0.62	0.60	0.60
query14	1.01	0.99	1.00
query15	0.84	0.82	0.84
query16	0.38	0.40	0.39
query17	1.03	1.05	1.00
query18	0.22	0.20	0.19
query19	1.88	1.78	1.76
query20	0.02	0.01	0.02
query21	15.43	0.23	0.12
query22	4.95	0.06	0.04
query23	15.69	0.25	0.10
query24	2.84	0.95	1.08
query25	0.07	0.07	0.07
query26	0.14	0.14	0.13
query27	0.06	0.05	0.05
query28	5.18	1.16	0.96
query29	12.63	3.90	3.19
query30	0.29	0.14	0.12
query31	2.81	0.59	0.37
query32	3.23	0.54	0.46
query33	2.99	3.04	2.99
query34	15.76	5.21	4.53
query35	4.56	4.55	4.56
query36	0.68	0.50	0.49
query37	0.09	0.07	0.07
query38	0.06	0.04	0.04
query39	0.04	0.03	0.03
query40	0.16	0.15	0.13
query41	0.09	0.04	0.03
query42	0.04	0.02	0.02
query43	0.04	0.04	0.03
Total cold run time: 98.87 s
Total hot run time: 27.79 s

yiguolei
yiguolei previously approved these changes Nov 21, 2025
@linrrzqqq linrrzqqq dismissed stale reviews from yiguolei and zclllyybb via 0ddae0f November 21, 2025 08:27
@github-actions github-actions bot removed the approved Indicates a PR has been approved by one committer. label Nov 21, 2025
@linrrzqqq
Copy link
Contributor Author

run buildall

Copy link
Contributor

@HappenLee HappenLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@github-actions github-actions bot added the approved Indicates a PR has been approved by one committer. label Nov 21, 2025
@github-actions
Copy link
Contributor

PR approved by at least one committer and no changes requested.

@doris-robot
Copy link

TPC-H: Total hot run time: 35004 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit 0ddae0febdb31b199b25c67900e2f630ba6b3f20, data reload: false

------ Round 1 ----------------------------------
q1	17599	4992	4917	4917
q2	2057	307	207	207
q3	10226	1328	738	738
q4	10234	919	358	358
q5	7575	2323	2402	2323
q6	180	168	135	135
q7	916	802	620	620
q8	9355	1336	1149	1149
q9	7090	5386	5410	5386
q10	6845	2205	1787	1787
q11	484	308	268	268
q12	330	379	229	229
q13	17763	3650	3036	3036
q14	229	235	214	214
q15	559	502	506	502
q16	1035	1008	968	968
q17	584	879	374	374
q18	7441	7104	7017	7017
q19	1245	952	566	566
q20	363	346	233	233
q21	4112	3248	2982	2982
q22	1057	1065	995	995
Total cold run time: 107279 ms
Total hot run time: 35004 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4935	4936	4931	4931
q2	326	387	311	311
q3	2178	2675	2326	2326
q4	1349	1769	1352	1352
q5	4211	4577	4653	4577
q6	216	177	131	131
q7	2075	1958	1796	1796
q8	2691	2630	2627	2627
q9	7717	7605	7496	7496
q10	3050	3223	2853	2853
q11	590	544	524	524
q12	706	764	621	621
q13	3502	3983	3321	3321
q14	293	299	289	289
q15	551	522	513	513
q16	1076	1123	1062	1062
q17	1167	1583	1388	1388
q18	7925	7807	7647	7647
q19	842	861	1063	861
q20	2079	2108	1989	1989
q21	4849	4292	4339	4292
q22	1112	1024	1011	1011
Total cold run time: 53440 ms
Total hot run time: 51918 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 185620 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit 0ddae0febdb31b199b25c67900e2f630ba6b3f20, data reload: false

query1	1037	401	387	387
query2	6561	1643	1669	1643
query3	6759	225	222	222
query4	26367	23012	22641	22641
query5	4435	646	488	488
query6	353	257	232	232
query7	4644	493	306	306
query8	316	258	258	258
query9	8716	2595	2601	2595
query10	511	350	302	302
query11	15298	15087	14942	14942
query12	195	121	118	118
query13	1722	579	454	454
query14	10886	9196	9128	9128
query15	196	183	173	173
query16	7652	682	525	525
query17	1233	739	609	609
query18	2028	416	320	320
query19	223	209	180	180
query20	133	123	118	118
query21	219	133	115	115
query22	4207	4309	4233	4233
query23	34104	33102	32932	32932
query24	8492	2392	2407	2392
query25	626	549	493	493
query26	1235	293	177	177
query27	2714	518	372	372
query28	4379	2220	2195	2195
query29	833	641	517	517
query30	298	228	199	199
query31	926	802	711	711
query32	84	78	84	78
query33	610	383	349	349
query34	806	859	534	534
query35	821	856	775	775
query36	963	1005	881	881
query37	130	115	95	95
query38	3523	3513	3477	3477
query39	1522	1427	1423	1423
query40	229	139	124	124
query41	71	71	66	66
query42	129	118	115	115
query43	491	502	467	467
query44	1295	797	800	797
query45	192	185	173	173
query46	881	1000	660	660
query47	1773	1805	1709	1709
query48	411	456	333	333
query49	804	502	420	420
query50	659	709	419	419
query51	3906	3932	3946	3932
query52	114	113	106	106
query53	258	275	202	202
query54	330	330	292	292
query55	89	95	94	94
query56	357	352	336	336
query57	1163	1194	1139	1139
query58	298	327	265	265
query59	2492	2647	2579	2579
query60	359	370	326	326
query61	166	165	163	163
query62	807	715	659	659
query63	233	201	199	199
query64	4442	1167	869	869
query65	4041	3963	3986	3963
query66	1135	446	322	322
query67	15458	15359	15000	15000
query68	8347	976	640	640
query69	489	326	292	292
query70	1298	1345	1245	1245
query71	479	342	327	327
query72	5842	2615	5348	2615
query73	808	784	375	375
query74	9285	8839	8713	8713
query75	4026	3321	2851	2851
query76	3768	1151	738	738
query77	812	417	343	343
query78	9549	9820	8964	8964
query79	1204	849	601	601
query80	662	582	527	527
query81	496	255	228	228
query82	434	166	134	134
query83	282	269	247	247
query84	259	118	99	99
query85	923	490	472	472
query86	343	337	296	296
query87	3770	3708	3671	3671
query88	2867	2254	2235	2235
query89	398	337	288	288
query90	1944	223	221	221
query91	181	166	136	136
query92	86	69	65	65
query93	1135	1020	692	692
query94	732	441	334	334
query95	414	319	318	318
query96	488	594	282	282
query97	2926	2994	2872	2872
query98	242	210	210	210
query99	1421	1393	1271	1271
Total cold run time: 274250 ms
Total hot run time: 185620 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 27.56 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit 0ddae0febdb31b199b25c67900e2f630ba6b3f20, data reload: false

query1	0.05	0.04	0.05
query2	0.10	0.05	0.05
query3	0.27	0.08	0.08
query4	1.60	0.11	0.11
query5	0.27	0.24	0.24
query6	1.17	0.66	0.63
query7	0.03	0.03	0.03
query8	0.05	0.04	0.04
query9	0.58	0.52	0.52
query10	0.57	0.57	0.58
query11	0.16	0.10	0.11
query12	0.15	0.12	0.13
query13	0.62	0.59	0.60
query14	1.00	0.99	0.99
query15	0.84	0.82	0.84
query16	0.40	0.39	0.39
query17	1.01	1.02	1.00
query18	0.21	0.20	0.19
query19	1.94	1.85	1.83
query20	0.01	0.01	0.01
query21	15.44	0.18	0.13
query22	5.01	0.08	0.05
query23	15.64	0.24	0.10
query24	2.82	0.53	0.51
query25	0.07	0.05	0.06
query26	0.14	0.12	0.12
query27	0.08	0.06	0.05
query28	4.76	1.11	0.93
query29	12.58	3.84	3.21
query30	0.28	0.14	0.11
query31	2.82	0.58	0.39
query32	3.24	0.55	0.46
query33	3.08	3.04	3.11
query34	15.93	5.13	4.64
query35	4.57	4.62	4.56
query36	0.70	0.50	0.49
query37	0.10	0.07	0.07
query38	0.07	0.04	0.04
query39	0.04	0.02	0.02
query40	0.18	0.15	0.15
query41	0.08	0.04	0.03
query42	0.04	0.03	0.03
query43	0.05	0.03	0.04
Total cold run time: 98.75 s
Total hot run time: 27.56 s

@doris-robot
Copy link

BE UT Coverage Report

Increment line coverage 83.56% (61/73) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 52.69% (18302/34733)
Line Coverage 38.13% (166577/436870)
Region Coverage 33.04% (129412/391633)
Branch Coverage 33.88% (55594/164113)

@linrrzqqq
Copy link
Contributor Author

run vault_p0

@hello-stephen
Copy link
Contributor

BE Regression && UT Coverage Report

Increment line coverage 93.15% (68/73) 🎉

Increment coverage report
Complete coverage report

Category Coverage
Function Coverage 71.51% (24374/34083)
Line Coverage 58.09% (253486/436391)
Region Coverage 53.39% (211813/396738)
Branch Coverage 54.74% (90323/165001)

Copy link
Contributor

@zclllyybb zclllyybb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zclllyybb zclllyybb merged commit 00661f4 into apache:master Nov 25, 2025
30 of 33 checks passed
@linrrzqqq linrrzqqq deleted the geo-fix branch November 25, 2025 13:24
github-actions bot pushed a commit that referenced this pull request Nov 25, 2025
The current `WkbParse::parse_wkb` function has a memory leak issue
caused by unreleased pointers, the pseudocode is as follows:
```cpp
struct WktContext {
    Shape* shape;
    Status parse_status;
};

void init (WktContext& ctx) {
    ctx.shape = (Shape*) malloc(sizeof(Shape));
    ctx.parse_status == GEO_PARSE_OK;
}

void parse_wkt(Shape** to_shape) {
    WktContext ctx;
    init(ctx);

    auto status = wkt_parse();
    if (status == GEO_PARSE_OK) {
        *to_shape = ctx.shape;
    } else {
        ctx.parse_status = GEO_PARSE_ERROR;
        // Here ctx.shape is not deleted, leading to memory leak
    }
}
```

This PR replaces some raw pointers in geo with `unique_ptr` to enhance
memory management safety and reduce potential memory leaks issues.
yiguolei pushed a commit that referenced this pull request Nov 26, 2025
Cherry-picked from #58004

Co-authored-by: linrrarity <linzhenqi@selectdb.com>
@yiguolei yiguolei mentioned this pull request Dec 2, 2025
nagisa-kunhah pushed a commit to nagisa-kunhah/doris that referenced this pull request Dec 14, 2025
The current `WkbParse::parse_wkb` function has a memory leak issue
caused by unreleased pointers, the pseudocode is as follows:
```cpp
struct WktContext {
    Shape* shape;
    Status parse_status;
};

void init (WktContext& ctx) {
    ctx.shape = (Shape*) malloc(sizeof(Shape));
    ctx.parse_status == GEO_PARSE_OK;
}

void parse_wkt(Shape** to_shape) {
    WktContext ctx;
    init(ctx);

    auto status = wkt_parse();
    if (status == GEO_PARSE_OK) {
        *to_shape = ctx.shape;
    } else {
        ctx.parse_status = GEO_PARSE_ERROR;
        // Here ctx.shape is not deleted, leading to memory leak
    }
}
```

This PR replaces some raw pointers in geo with `unique_ptr` to enhance
memory management safety and reduce potential memory leaks issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. dev/4.0.2-merged reviewed usercase Important user case type label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments