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
nullas the source-to-clone argument, that's literally the same as just callinggearman_client_create - if the destination argument is
NULL, agearman_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 usinggearman_client_create()orgearman_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_createreturns a pointer to thegearman_client_stthat was created (or initialized). on an allocation failure, it returnsNULL.gearman_client_clonereturns a pointer to thegearman_client_stthat was created (or initialized). on an allocation failure, it returnsNULL.
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 β¨
π Copyright
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
- ubuntu resolute: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libgearman-dev 1.1.21+ds-1ubuntu3 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms