GithubHelp home page GithubHelp logo

malloc's Introduction

Malloc

This is a personal implementation of the functions: malloc(), free(), and realloc().

The design

alt text

Tiny and Small allocations

On the first call to malloc() a "slab" sized chunk of memory will be mapped to the program's memory space. The slab will be segmented into 'tiny' and 'small' blocks, and each block with have a portion of meta-data at its head to manage the block. Sequential calls to malloc() will return pointers to sufficiently sized blocks in said slab. Once the slab has run out of blocks to allocate, a new slab will be mapped, segmented, and a block from the new slab will be given.

The manager of these slabs keeps a reference to the next tiny and small blocks that can be given, to increase speed. And when a block is returned from the user, that block will be queued for the next allocation.

Large allocations

All requests exceeding the size of our small blocks will be mapped separately and stored together as a linked list. When returned from the user, the resource will be immediately given back to the system.

How to compile:

git clone https://github.com/dauie/malloc.git

cd malloc

git clone https://github.com/dauie/libft.git

make

malloc's People

Contributors

dauie avatar

Stargazers

 avatar Zeid Tisnes avatar Keenan Romain avatar

Watchers

James Cloos 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.