Skip to content

Commit 627ae8c

Browse files
committed
Bug #34454572 : Clone_persist_gtid causes memory leak
Description: ============ The Clone_persist_gtid thread causes memory leak. Analysis: ========= The Clone_persist_gtid thread that runs in the background write GTIDs periodically to disk table. In this process, the thd allocates memory to store the information about the tables to be locked while flushing GTIDs. This memory is not freed until the shutdown is called, causing the memory consumption or slow memory leak. Fix: ==== Release the memory that was allocated by calling the ClearForReuse() after the GTIDs are flushed in each cycle. Change-Id: Ib28a2c5134b5d223c48224916911199f260f52b5
1 parent e00328b commit 627ae8c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

storage/innobase/clone/clone0repl.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,12 @@ void Clone_persist_gtid::periodic_write() {
610610
os_event_reset(m_event);
611611
/* Write accumulated GTIDs to disk table */
612612
flush_gtids(thd);
613+
/* Memory is allocated from thd->memroot to store the information about the
614+
table being locked for flushing gtids. In this case, being a background
615+
thread which is flushing the gtids every 100 millisecond, we should release
616+
the memory after every cycle of flushing gtids to avoid memory growth in
617+
Clone_persist_gtid thread .*/
618+
thd->mem_root->ClearForReuse();
613619
}
614620

615621
/* For slow shutdown, consume remaining GTIDs so that undo can be purged. */

0 commit comments

Comments
 (0)