this post was submitted on 24 Jan 2024
1 points (100.0% liked)

Zig Programming Language

157 readers
1 users here now

A lemm.ee community for Zig!

founded 1 year ago
MODERATORS
 

From the README:

jdz_allocator: A Zig General Purpose Memory Allocator

jdz_allocator is an original general purpose allocator inspired by Mattias Jansson's rpmalloc.

In its default configuration, it uses no global or threadlocal vars, making it compatible with Zig allocator design. This allows it to function without the need for any deinitThread calls while still achieving reasonable multi-threaded performance.

If multithreaded performance is essential, and cannot be handled appropriately through the use of multiple allocator instances, this allocator can be configured to use threadlocal arenas by setting global_allocator=true in the JdzAllocatorConfig. In this mode, make sure to call deinitThread before thread termination to free thread memory for re-use.

The global allocator is currently accessed through a JdzAllocator instance rather than the JdzAllocator type, which makes global global use inconvenient and error-prone - this will be addressed shortly.

Please note that this allocator is a work in progress, and has not yet been thoroughly tested. Usage and bug reports are appreciated and will help contribute to this allocator's completion.

Performance is also still being worked on, with a few obvious targets for improvement.

This allocator currently does not support page sizes larger than 64KiB.

no comments (yet)
sorted by: hot top controversial new old
there doesn't seem to be anything here