globus_memory(3)

πŸ“¦
version 18.15 Β· 6 versions
, in epel 10, fedora 43, fedora 44, ubuntu resolute, ubuntu stonking

πŸ’– globus_memory β€” the manual page, bestie edition πŸ’–

okay so this is globus_memory(3), straight out of the Library Functions Manual, and it's literally about a Memory Pool. yeah. a pool. for memories. well β€” for memory. let's go 🫢


✨ NAME ✨

globus_memory β€” Memory Pool

  • Memory Pool.

(that's it. that's the name. short, sweet, iconic πŸ‘‘)


🌸 SYNOPSIS 🌸

Functions

  • globus_bool_t globus_memory_init (globus_memory_t *mem_info, int node_size, int node_count) β€” Initialize memory pool.
  • void * globus_memory_pop_node (globus_memory_t *mem_info) β€” Retrieve a memory item from a pool.
  • globus_bool_t globus_memory_push_node (globus_memory_t *mem_info, void *buffer) β€” Return a memory item to the pool.
  • globus_bool_t globus_memory_destroy (globus_memory_t *mem_info) β€” Destroy a memory pool.

πŸ¦‹ Detailed Description πŸ¦‹

Memory Pool.

The globus_memory abstraction implements a memory management pool for groups of same-sized data items. πŸ’…

like, imagine a little VIP lounge where every single guest is the exact same size. no chaos, no drama, just vibes and identical chunks. that's the whole concept, fr fr ✨


πŸŽ€ Function Documentation πŸŽ€

globus_bool_t globus_memory_destroy (globus_memory_t * mem_info)

Destroy a memory pool. Free all the memory associated with the memory management structure. For every call to globus_memory_init() there should be a call to globus_memory_destroy() or else memory will leak. 😭

bestie. BESTIE. do not forget the globus_memory_destroy(). every globus_memory_init() needs its matching destroy, or your memory just… leaks. forever. haunting you. the leak is the villain of this story πŸ’€

globus_bool_t globus_memory_init (globus_memory_t * mem_info, int node_size, int node_count)

Initialize memory pool. Initialize the globus memory management structure. 🌈

Before using any functions associate with a memory structure this function must be called. ⭐

Parameters

  • mem_info β€” The memory management datatype
  • node_size β€” The size of the memory to allocated with each pop.
  • node_count β€” The initial number of nodes allocated with the memory management structure. If it is exceeded more will be allocated.

so yeah, node_count is giving "starting amount" energy, not "limit" energy β€” if you blow past it, more nodes just get allocated. no cap. the pool grows πŸ’–


void * globus_memory_pop_node (globus_memory_t * mem_info)

Retrieve a memory item from a pool. Pop a chunk of memory out of the memory management structure. Similar to malloc(). When no longer using this item, return it to the pool via globus_memory_push_node(). πŸ“

it's giving malloc() but make it a whole pool system. take a chunk, use it, then give it back β€” the circle of life, honestly 🧚


globus_bool_t globus_memory_push_node (globus_memory_t * mem_info, void * buffer)

Return a memory item to the pool. Push a chunk of memory back into the memory management structure. Similar to free(). πŸ’œ

yeah bestie, this is the free()-coded part. put the chunk back where you found it, the pool is counting on you 🫢


πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for globus_common from the source code.


okay that's the whole page, and fr fr you ate it πŸ’… one last cute lil sign-off: this whole thing is globus_common, Version 18.15, and the page is globus_memory(3) β€” mwah, go forth and manage your pools responsibly βœ¨πŸŽ€πŸ¦‹