[MDEV-27627] Memory not freed: 256/264/280/312 when using FOR...IN Created: 2022-01-26  Updated: 2023-12-12

Status: Confirmed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Dmitry Shulga
Resolution: Unresolved Votes: 0
Labels: affects-tests, memory_not_freed


 Description   

FOR rec IN cur (2) DO SELECT * a;
SHUTDOWN;

2022-01-26 18:48:19 0 [Note] /test/MD190122-mariadb-10.8.0-linux-x86_64-dbg/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 280
Warning:  280 bytes lost at 0x15520001f630, allocated by T@0 at 0x55e20e710fe3, mysys/array.c:72, mysys/hash.c:98, sql/sp.cc:2330, sql/sp.cc:2645, sql/item_create.cc:2622, sql/item_create.cc:2471, sql/sql_yacc.yy:10468
Memory lost: 280 bytes in 1 chunks
Warning:  280 bytes lost at 0x15520001f630, allocated by T@0 at sql/sql_parse.cc:10379, mysys/array.c:72, mysys/hash.c:98, sql/sp.cc:2330, sql/sp.cc:2645, sql/item_create.cc:2622, sql/item_create.cc:2471, sql/sql_yacc.yy:10468
Memory lost: 280 bytes in 1 chunks

10.8.0 e222e44d1bfc995870430bb90d8ac97e91f66cb4 (Optimized)

2022-01-26 18:52:17 0 [Note] /test/MD190122-mariadb-10.8.0-linux-x86_64-opt/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 280

10.3.33 97425f740faf83ac2d16585084476470f3f898ce (Optimized)

2022-01-26 18:50:30 0 [Note] /test/MD190122-mariadb-10.3.33-linux-x86_64-opt/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 264

10.3.33 97425f740faf83ac2d16585084476470f3f898ce (Debug)

2022-01-26 18:50:29 0 [Note] /test/MD190122-mariadb-10.3.33-linux-x86_64-dbg/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 256
Warning:  256 bytes lost at 0x14e3c4020020, allocated by T@0 at mysys/array.c:70, mysys/hash.c:98, sql/sp.cc:2290, sql/sp.cc:2605, sql/item_create.cc:3512, sql/item_create.cc:3361, sql/sql_yacc.yy:11201, sql/sql_parse.cc:10199
Memory lost: 256 bytes in 1 chunks
Warning:  256 bytes lost at 0x14e3c4020020, allocated by T@0 at mysys/array.c:70, mysys/hash.c:98, sql/sp.cc:2290, sql/sp.cc:2605, sql/item_create.cc:3512, sql/item_create.cc:3361, sql/sql_yacc.yy:11201, sql/sql_parse.cc:10199
Memory lost: 256 bytes in 1 chunks



 Comments   
Comment by Roel Van de Paar [ 2022-08-27 ]

Up to 10.11

10.11.0 bc563f1a4b0b38de3b41fd0f0d3d8b7f1aacbd8b (Debug)

2022-08-27 14:17:48 0 [Note] /test/MD190822-mariadb-10.11.0-linux-x86_64-dbg/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 280
Warning:  280 bytes lost at 0x1464f801f4a0, allocated by T@0 at 0x561d327d5c03, 0x561d327d9aec, 0x561d32264afa, 0x561d322653dd, mysys/array.c:72, mysys/hash.c:102, sql/sp.cc:2328, sql/sp.cc:2643
Memory lost: 280 bytes in 1 chunks
Warning:  280 bytes lost at 0x1464f801f4a0, allocated by T@0 at sql/item_create.cc:2719, sql/item_create.cc:2565, sql/sql_yacc.yy:10480, sql/sql_parse.cc:10426, mysys/array.c:72, mysys/hash.c:102, sql/sp.cc:2328, sql/sp.cc:2643
Memory lost: 280 bytes in 1 chunks

Comment by Roel Van de Paar [ 2022-09-28 ]

This testcase variation

FOR rec IN cur (0) DO SELECT * cur;
SET GLOBAL session_track_system_variables='a';
SHUTDOWN;

Leads to:

Warning: Memory not freed: 312

In all versions from 10.5 to 10.11, both debug and optimized. Possibly a split/additional issue.

Generated at Thu Feb 08 09:54:22 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.