mysql_thread_end(3)

πŸ“¦
version 13.0.2 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– mysql_thread_end(3) β€” MariaDB Connector/C πŸ’–

okay bestie, gather round, we're talking about mysql_thread_end() from the MariaDB Connector/C fam 🌸


✨ Name ✨

mysql_thread_end β€” releases thread specific memory 🧹✨


πŸ¦‹ Synopsis πŸ¦‹

#include <mysql.h>

void mysql_thread_end(void );

(yes the space before that closing paren is exactly how it's written, no I will not be fixing it, it's canon πŸ’…)


πŸ’… Description πŸ’…

ok so listen. mysql_thread_end() is the function you gotta call before a client thread ends. like, before it dips, before it logs off, before it goes to sleep forever 😭

what it does: it releases the thread specific memory that was allocated by a previous mysql_thread_init(3) call. that's the whole job. very demure, very mindful.

returns void. it gives you nothing back, and honestly? iconic behavior πŸ‘‘


πŸŽ€ Notes πŸŽ€

ok this is the important part, pay attention bestie πŸ™ˆ

unlike mysql_thread_init(3), mysql_thread_end() will NOT be invoked automatically when the thread ends. like, nobody's gonna do it for you. no autopilot, no safety net, no little angel on your shoulder πŸ˜‡βŒ

so to avoid memory leaks, mysql_thread_end() must be called explicitly. that's a must, not a maybe. fr fr. periodt. πŸ”₯


🌈 History 🌈

this function is deprecated since MariaDB Connector/C 3.0.0. she's a legacy queen, we still love her, but the vibes have moved on πŸ’€


🫢 See also 🫢


and that's the whole page, bestie!! Version 3.4 of the MariaDB Connector/C manny, brought to you with so much love and zero memory leaks (as long as you call that function, which you WILL, right? RIGHT? πŸ˜€πŸ’–). mwah, go forth and clean up your threads πŸ§šβ­πŸ“

πŸ“¦ where this page comes from