GEARMAN_WORKER...ORY_ALLOCATORS(3)

πŸ’… NAME πŸ’…

gearman_worker_set_memory_allocators β€” Gearmand Documentation, http://gearman.info/

okay bestie, we're deep in the Gearmand man pages (manual name <rainbow>GEARMAN_WORKER...ORY_ALLOCATORS</rainbow>, section 3, the library-calls girly) and this one is all about telling libgearman exactly who's gonna be handling your memory. it's giving "let me do it myself" energy and honestly? iconic. πŸ’–


✨ SYNOPSIS ✨

first, you gotta pull in the header, no cap:

#include <libgearman/gearman.h>

then we got the types, our little type-fam:

type gearman_allocator_t

type gearman_malloc_fn

type gearman_free_fn

type gearman_realloc_fn

type gearman_calloc_fn

and then the actual functions, both returning gearman_return_t:

gearman_return_t gearman_client_set_memory_allocators(gearman_client_st*, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context)

gearman_return_t gearman_worker_set_memory_allocators(gearman_worker_st*, gearman_malloc_fn *malloc_fn, gearman_free_fn *free_fn, gearman_realloc_fn *realloc_fn, gearman_calloc_fn *calloc_fn, void *context)

and hello?? don't forget to link the girl:

Link to -lgearman

like, <hotpink>link to -lgearman</hotpink> or she simply will not show up. 🫢


🌸 DESCRIPTION 🌸

so true story: this function installs callbacks for custom allocation. that's the whole vibe. πŸ’…

normally, malloc(3) and free(3) are the ones doing all the work β€” allocating and releasing workloads, being the main characters. but you can absolutely take the aux cord and use gearman_client_set_memory_allocators() and gearman_worker_set_memory_allocators() to set your own custom allocators. your memory, your rules. no cap. πŸ”₯


πŸ’€ RETURN VALUE πŸ’€

None

girl... it just says None. that's it. that's the whole sentence. not me getting zero crumbs of info on the return value. 😭

See also: gearmand(8) libgearman(3) gearman_client_st(3)


🧚 Author 🧚

Data Differential http://www.datadifferential.com/

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


and that's the whole page bestie, we ate and left no crumbs ✨ β€” this lil' doc is from version 1.1.21+ds, dated Feb 04, 2024, and it came to you straight from the Gearmand source. mwah, go write a custom allocator, i believe in you πŸ¦‹πŸŒΈπŸ’œ

πŸ“¦ where this page comes from