Git Product home page Git Product logo

hoardmemoryallocator's Introduction

hoardMemoryAllocator

Simple Hoard memory allocator. Implements malloc(), free(), calloc(), realloc(), and poisoning for malloc() and free().

In order to run on a linux machine follow these commands:

If not using bash, type:

bash

Then, to compile the program using the Makefile, type:

make

To run the program type:

LD_PRELOAD=./th_alloc.so ./your_command_or_binary

if you would like to run test.c follow these commands:

bash
make
LD_PRELOAD=./th_alloc.so ./test

Overrides default malloc() and free() functionality.

Following the HOARD model, we preferred to make free blocks of memory easily accesible by placing them at the beginning of the free list.

When two whole superblocks were free, we traversed the list and removed the last instance of a free whole superblock, so that we could keep as many free whole blocks towards the front of the list as possible.

For poisoning, we poisoned all of the memory that was malloced. With the free poisoning, we wanted to maintain the free_list pointer, so we offset the poisoning start by 8 bytes.

Approach for calloc was straightforward and relied on our malloc implementation and memset.

Realloc was designed to only reallocate new memory if the parameter size was larger than what the pointer currently pointed to. This way we wouldnt have to free the memory and call malloc again if the requested size would fall into what was already being utilized. If a null pointer was passed to realloc, then we just call malloc with the size and ignore the parameter pointer.

hoardmemoryallocator's People

Contributors

chenchik avatar

Watchers

James Cloos avatar  avatar Greer Glenn 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.