GEARMAN_CLIENT...ORY_ALLOCATORS(3)

πŸ’– GEARMAN_CLIENT...ORY_ALLOCATORS πŸ’–

okay bestie, welcome to the Gearmand girlies' club (manual section 3, we're fancy like that ✨). This is your little guide to handing libgearman your own memory allocators, and honestly? iconic behaviour. πŸŽ€


🌸 NAME 🌸

gearman_client_set_memory_allocators β€” the Gearmand Documentation situation, over at http://gearman.info/ πŸ’…


✨ SYNOPSIS ✨

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

#include <libgearman/gearman.h>

then we've got the little type squad (they're the main characters, fr):

type gearman_allocator_t

type gearman_malloc_fn

type gearman_free_fn

type gearman_realloc_fn

type gearman_calloc_fn

and the actual function signatures, both of them, exactly as they come:

gearman_return_t <#c.gearman_return_t>
gearman_client_set_memory_allocators(gearman_client_st <#c.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 <#c.gearman_return_t>
gearman_worker_set_memory_allocators(gearman_worker_st <#c.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 when you link, you link it like this 🫢:

Link to -lgearman

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically: you're installing callbacks for custom allocation. that's the vibe. ✨

normally, malloc(3) and free(3) are the ones doing the allocation and releasing workloads β€” they're the default duo, doing their thing quietly in the background, no drama. but bestie, you can swap them out. use gearman_client_set_memory_allocators() and gearman_worker_set_memory_allocators() to set your own custom allocators. your memory, your rules, periodt. πŸ‘‘

ngl, this is the part where you get to be the main character of your own heap. slay. πŸ’…

⭐ RETURN VALUE ⭐

None. literally nothing comes back. it's giving "no notes, no receipts". πŸ«₯

See also: πŸ‘€


πŸ’œ Author πŸ’œ

Data Differential β€” http://www.datadifferential.com/


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


that's the whole page, bestie!! version 1.1.21+ds, dated Feb 04 β€” go forth and allocate responsibly, ily, bye!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«ΆπŸ‘‘πŸŒˆβ­

πŸ“¦ where this page comes from