1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

MDEV-39141 MariaDB crashes in THD::THD() due to misalignment

fix alloc_root() and my_malloc() to return 16-aligned pointers

(type_assoc_array.sp-assoc-array-64bit prints changes in memory_used,
and my_malloc() uses more memory now)
This commit is contained in:
Sergei Golubchik
2026-04-16 00:04:40 +02:00
parent 5f262639fe
commit 26606cefdc
3 changed files with 8 additions and 6 deletions

View File

@@ -41,6 +41,8 @@
#define TRASH_MEM(X) TRASH_FREE(((char*)(X) + ((X)->size-(X)->left)), (X)->left)
#undef ALIGN_SIZE
#define ALIGN_SIZE(X) MY_ALIGN(X, 16)
/*
Alloc memory through either my_malloc or mmap()

View File

@@ -26,7 +26,7 @@ struct my_memory_header
PSI_memory_key m_key;
};
typedef struct my_memory_header my_memory_header;
#define HEADER_SIZE 24
#define HEADER_SIZE MY_ALIGN(sizeof(my_memory_header), 16)
#define USER_TO_HEADER(P) ((my_memory_header*)((char *)(P) - HEADER_SIZE))
#define HEADER_TO_USER(P) ((char*)(P) + HEADER_SIZE)

View File

@@ -44,15 +44,15 @@ END;
/
CALL p1;
id diff
p0 176
p0 200
id diff
p1 376
p1 424
id diff
p2 2624
p2 2696
id diff
p2upd 2624
p2upd 2696
id diff
p2del 376
p2del 424
diff1
0
DROP PROCEDURE p1;