GEARMAN_CLIENT_FREE(3)

πŸ’– GEARMAN_CLIENT_FREE πŸ’–

okay bestie, welcome to gearman_client_free, the whole libgearman situation, from the Gearmand docs over at <http://gearman.info/> 🫢 this one's the cleanup crew, the "we're done here, let's not leak memory" moment. iconic behavior honestly.


✨ SYNOPSIS ✨

#include <libgearman/gearman.h>

gearman_client_st <#c.gearman_client_st>
*gearman_client_create(gearman_client_st <#c.gearman_client_st> *client)

gearman_client_st <#c.gearman_client_st>
*gearman_client_clone(gearman_client_st <#c.gearman_client_st> *client,
const gearman_client_st <#c.gearman_client_st> *from)

void gearman_client_free(gearman_client_st <#c.gearman_client_st>
*client)

Link with -lgearman

🌸 DESCRIPTION 🌸

okay so first things first, gearman_client_create() is the girl that builds you a c:type:gearman_client_st structure πŸ’… and then all the other libgearman client functions use it to talk to the server. you've got two paths here:

  • pass in a statically declared gearman_client_st <#c.gearman_client_st> and she'll work with that
  • or pass NULL, and a whole new structure gets allocated for you πŸŽ€

then there's gearman_client_clone(), which is like gearman_client_create() but make it copy-paste energy πŸ‘― it copies the defaults and the list of servers from the source gearman_client_st <#c.gearman_client_st>. a couple of little rules tho:

  • if you pass null as the source-to-clone argument, that's literally the same as just calling gearman_client_create
  • if the destination argument is NULL, a gearman_client_st <#c.gearman_client_st> gets allocated for you πŸ’–

and now the main character: to clean up the memory hanging onto a gearman_client_st <#c.gearman_client_st> structure, you hand it over to gearman_client_free when you're done with it. no cap, gearman_client_free() is the only way to make sure all the memory is actually deallocated when you finish using the structure. it's not one of many options, it's the option. periodt.

⚠️ warning bestie, this one matters: you may wish to avoid using gearman_client_create() or gearman_client_clone() with a stack based allocation, i.e. the first parameter. the most common issues related to ABI safety involve stack allocated structures. so like… don't do that one? πŸ™ˆ

⭐ RETURN VALUE ⭐

  • gearman_client_create returns a pointer to the gearman_client_st that was created (or initialized). on an allocation failure, it returns NULL.
  • gearman_client_clone returns a pointer to the gearman_client_st that was created (or initialized). on an allocation failure, it returns NULL.

both of them, allocation failure, NULL. that's the vibe check πŸ’€


πŸ¦‹ HOME πŸ¦‹

to find out more information please check: <http://gearman.info/> 🌈

see also:


πŸ’œ Author

Data Differential <http://www.datadifferential.com/> β€” the queens behind all this ✨

2011-2014, Data Differential, <http://www.datadifferential.com/>


and that's the whole page, bestie!! πŸ₯° this was lovingly served to you from 1.1.21+ds, dated Feb 04, 2026 β€” go forth, create your clients, free your clients, don't leak, slay πŸ’…πŸ’–βœ¨

πŸ“¦ where this page comes from