Coder Social home page Coder Social logo

billyquith / rpmalloc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from coherentlabs/rpmalloc

0.0 3.0 0.0 1.72 MB

Public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C

License: Other

C++ 100.00%

rpmalloc's Introduction

coherent-rpmalloc - Coherent Labs' fork of the Fork Rampant Pixels Memory Allocator

This library provides a public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C++. This version is a fork of https://github.com/rampantpixels/rpmalloc.

Platforms currently supported:

  • Windows
  • MacOS
  • iOS
  • Linux
  • Android
  • PlayStation 4
  • Xbox One

This library is put in the public domain; you can redistribute it and/or modify it without any restrictions. Or, if you choose, you can use it under the MIT license.

Originally created by Mattias Jansson (@maniccoder) / Rampant Pixels - http://www.rampantpixels.com

Fork and modifications by Coherent Labs (@CoherentLabs) - http://www.coherent-labs.com

Implementation

A detailed description of the rpmalloc original allocator is available at the GitHub page of the creator https://github.com/rampantpixels/rpmalloc. This version has significant changes and modifications.

The allocator provides generic C++ high-performance memory management across multiple platforms.

Key features include:

  • High performance in multi-threaded environments
  • Very low memory overhead for book-keeping
  • Embeddability - does not depend on the OS allocator
  • Cross-platform - requires a C++11 atomic STL implementation, no other external dependencies

Differences from the main rpmalloc

coherent-rpmalloc removes some significant requirements of the original implementation.

  • No need to align external allocations to 64KB.
  • Reduced the allocation granularities and how much memory the allocator "keeps", which in turn reduces the overall footprint of memory managed by it.
  • Removed span classes, because all spans have the same number of pages.
  • Moved to C++11 in order to easily port on multiple platforms that have no compiler support for C11.
  • Removed the requirement to do thread initialization/deinitialization by hand - the library will work on any thread all the time.

Usage

The embedding application must implement the rpmalloc_allocate_memory_external and rpmalloc_deallocate_memory_external functions that will be called when the allocator needs new space to use or returns some to the OS.

The allocator has to be initialized and deinitialized with the rpmalloc_initialize and rpmalloc_finalize functions.

After that allocations can be performed with rpmalloc and family functions. The allocator will work transparently on any thread after it has been initialized. This is different from the original version, which required per-thread init/deinit.

rpmalloc's People

Contributors

mjansson avatar andoma avatar looki avatar

Watchers

James Cloos avatar Bill Quith avatar  avatar

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.