Consider the following case:
CREATE TABLE t1 (a INT, b VARCHAR(30)) CHARSET=utf8mb4;
|
INSERT INTO t1 VALUES (1, 'one'), (0, NULL), (3, 'three'), (4, 'four');
|
PREPARE stmt1 FROM 'DELETE FROM t1 WHERE b=?' ;
|
SET @arg00=NULL;
|
EXECUTE stmt1 USING @arg00; # <<=== First time the prepared statement 'stmt1' is executed
|
SET @arg00='one';
|
EXECUTE stmt1 USING @arg00; <<=== Second time the same prepared statement is executed results in memory leaks
|
The essential prerequisite in the above use case is that the table t1 is created with CHARSET=utf8mb4. Without explicit clause 'CHARSET=utf8mb4' in CREATE TABLE statement, the aforementioned test case would complete with success up to 11.6 where the default characterset was changed from latin1 to utf8mb4 (commit 36eba98817339f53cc57f1d4884ace3efb38db8d)