include/Zy...llocator.h(3)
π include/Zycore/Allocator.h π
okay so bestie, you opened a page from the Library Functions Manual β it's the include/Zycore/Allocator.h entry β and I'm about to make allocators make sense. this whole thing is Doxygen-generated docs for Zycore's allocator header, so let's get into it πΈ
β¨ NAME β¨
include/Zycore/Allocator.h β the header where Zycore keeps its allocator class and function prototypes π«Ά
π SYNOPSIS π
#include <Zycore/Status.h>
#include <Zycore/Types.h>
π Classes
struct ZyanAllocator_
π¦ Typedefs
typedef ZyanStatus(* ZyanAllocatorAllocate) (struct ZyanAllocator_ *allocator, void **p, ZyanUSize element_size, ZyanUSize n)typedef ZyanStatus(* ZyanAllocatorDeallocate) (struct ZyanAllocator_ *allocator, void *p, ZyanUSize element_size, ZyanUSize n)typedef struct ZyanAllocator_ ZyanAllocator
β Functions
ZYCORE_EXPORT ZyanStatus ZyanAllocatorInit (ZyanAllocator *allocator, ZyanAllocatorAllocate allocate, ZyanAllocatorAllocate reallocate, ZyanAllocatorDeallocate deallocate)ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanAllocator * ZyanAllocatorDefault (void)
π Typedef Documentation π
π typedef struct ZyanAllocator_ ZyanAllocator
Defines the ZyanAllocator struct. periodt.
This is the base class for all custom allocator implementations β if you're building your own allocator vibe, this is the blueprint, iykyk.
π¨ All fields in this struct should be considered as "private". Any changes may lead to unexpected behavior. like fr fr, hands off the internals, bestie. she's not yours.
πΈ typedef ZyanStatus(* ZyanAllocatorAllocate) (struct ZyanAllocator_ *allocator, void **p, ZyanUSize element_size, ZyanUSize n)
Defines the ZyanAllocatorAllocate function prototype. this is the shape your allocate function has to have, no cap.
Parameters
allocatorβ A pointer to theZyanAllocatorinstance.pβ Receives a pointer to the first memory block sufficient to hold an array ofnelements with a size ofelement_size.element_sizeβ The size of a single element.nβ The number of elements to allocate storage for.
Returns
- A zyan status code.
This prototype is used for the allocate() and reallocate() functions β one signature, two jobs, multitasking queen π
π The result of thereallocate()function is undefined, ifpdoes not point to a memory block previously obtained by(re-)allocate(). undefined behavior means undefined behavior, bestie. do not pass her a random pointer and act surprised.
π§ typedef ZyanStatus(* ZyanAllocatorDeallocate) (struct ZyanAllocator_ *allocator, void *p, ZyanUSize element_size, ZyanUSize n)
Defines the ZyanAllocatorDeallocate function prototype β the cleanup era.
Parameters
allocatorβ A pointer to theZyanAllocatorinstance.pβ The pointer obtained from(re-)allocate().element_sizeβ The size of a single element.nβ The number of elements earlier passed to(re-)allocate().
Returns
- A zyan status code.
π₯ Function Documentation π₯
π
ZYCORE_EXPORT ZYAN_REQUIRES_LIBC ZyanAllocator * ZyanAllocatorDefault (void)
Returns the default ZyanAllocator instance. the main character of allocators β¨
Returns
- A pointer to the default
ZyanAllocatorinstance.
The default allocator uses the default memory manager to allocate memory on the heap.
π« You should in no case modify the returned allocator instance to avoid unexpected behavior. not even a little. not even a tiny field. leave her alone, she's thriving.
π ZYCORE_EXPORT ZyanStatus ZyanAllocatorInit (ZyanAllocator * allocator, ZyanAllocatorAllocate allocate, ZyanAllocatorAllocate reallocate, ZyanAllocatorDeallocate deallocate)
Initializes the given ZyanAllocator instance. set her up, hand her the callbacks, done.
Parameters
allocatorβ A pointer to theZyanAllocatorinstance.allocateβ The allocate function.reallocateβ The reallocate function.deallocateβ The deallocate function.
Returns
- A zyan status code.
π also yes,allocateandreallocateare both declared asZyanAllocatorAllocateup there β that's genuinely what the header says, I'm not making it up, and the typedef docs literally tell you the same prototype covers both. slay.
π Author π
Generated automatically by Doxygen for Zycore from the source code. she didn't write herself, bestie, a tool did it π
and that's the whole page!! this one lives in Zycore, Version 1.5.2.0, and the footer doesn't carry a date so there's no date to give you β just the source <rainbow>Zycore</rainbow> and that version number. go forth and allocate responsibly ππ¦β¨
π¦ where this page comes from
- ubuntu resolute: libzycore-doc 1.5.2-1build1 Β· MIT
- ubuntu stonking: libzycore-doc 1.5.2-1build1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms