Giter Site home page Giter Site logo

liballoc's Introduction

liballoc - a small memory allocator

This is liballoc, a memory allocator for hobby operating systems, originally written by Durand. According to the original page for liballoc it was released into the public domain, but the copy I have contains the 3 clause BSD license.

liballoc.c/h are the original release of liballoc taken from the spoon tarball while liballoc_1_1.c/h are later versions found by detective work using Google.

Using liballoc

There are 4 functions which you need to implement on your system:

int   liballoc_lock();
int   liballoc_unlock();
void* liballoc_alloc(int);
int   liballoc_free(void*,int);
  1. Have a look at liballoc.h for information about what each function is supposed to do.

  2. Have a look at linux.c for an example of how to implement the library on linux.

NOTE: There are two ways to build the library:

1) Compile the library with a new system file. For example, I've
   left linux.c with the default distribution. It gets compiled
   directly into the liballoc_linux.so file.

2) Implement the functions in your application and then just
   link against the default liballoc.so library when you compile
   your app.

Quick Start

You can simply type: "make linux" to build the linux shared library. Thereafter, you can link it directly into your applications during build or afterwards by export the LD_PRELOAD environment variable.

To run bash with the library, for example:

LD_PRELOAD=/full/path/to/liballoc.so bash

The above command will pre-link the library into the application, essentially replacing the default malloc/free calls at runtime. It's quite cool.

Originally by: Durand Miller

liballoc's People

Contributors

blanham avatar

Watchers

James Cloos avatar Bob Cao 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.