Code Monkey home page Code Monkey logo

adma's Introduction

A.D.M.A - Acronyms Dont Mean Anything

Adma is a general purpose allocator for zig with the following features:

  • Slab Allocation strategy
  • Optimized for rapid small memory allocation/releasing
  • Reuse of OS provided allocations
  • Non-Blocking allocation & free within a thread
  • Multithreaded Capable
  • Automatic feature reduction for single threaded use
  • Safe freeing of memory sent to a different thread

Getting started

In Zig:

const adma = @Import("adma");

pub fn example() !void {
    // .initWith using a c allocator
    //const adma_ref = try adma.AdmaAllocator.initWith(std.heap.c_allocator, 0);

    // .init defaults to using std.heap.page_allocator underneath for ease of use
    const adma_ref = adma.AdmaAllocator.init();
    defer adma_ref.deinit();

    const allocator = &adma_ref.allocator;

    var buf = try allocator.alloc(u8, 100);
    defer allocator.free(buf);
}

Usage Notes

  • If using adma in a multithreaded context, ensure you AdmaAllocator.init/deinit in every thread; not pass the allocator pointer to the additional thread
  • If using for zig prior to the big allocation interface change, see the branch called pre-allocator-revamp

adma's People

Contributors

mattnite avatar suirad avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mattnite

adma's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.