Giter VIP home page Giter VIP logo

heap-management-system's Introduction

Heap Management System

This project implements a heap management system in C, providing functionalities for dynamic memory allocation, deallocation, and memory usage inspection.

Contents

  1. Introduction
  2. Components
  3. Memory Management Functions
  4. Error Handling
  5. Usage

Introduction

The heap management system consists of a header file (cHEAP.h) and an implementation file (cHEAP.c). It includes functionalities to allocate, deallocate, and inspect memory blocks within a fixed-size memory pool.

Components

  • Header File (cHEAP.h):

    • Defines constants, data types, and function prototypes.
    • Contains macros for error handling.
  • Implementation File (cHEAP.c):

    • Implements memory management functions.
    • Defines a fixed-size memory pool and free list for managing memory blocks.

Memory Management Functions

  1. _initializer_(): Initializes the heap.
  2. cHEAP_AllocateNew(): Allocates memory blocks.
  3. cHEAP_Release(): Deallocates memory blocks.
  4. cHEAP_InspectFreeSpace(): Prints information about free memory blocks.
  5. cHEAP_Length(): Gets the size of an allocated memory block.
  6. cHEAP_IfAllocatable(): Checks if memory of a given size can be allocated.
  7. cHEAP_Nullify(): Nullifies memory contents.
  8. cHEAP_GetTotalFreeSpace(): Gets total free space in the heap.
  9. cHEAP_GetTotalAllocatedSpace(): Gets total allocated space in the heap.
  10. cHEAP_DeallocateAll(): Deallocates all memory blocks in the heap.

Error Handling

The system includes error handling mechanisms using errno and custom error messages for scenarios like segmentation faults, non-accessible memory, attempted deallocation of already freed memory, and illegal memory access.

Usage

To use the heap management system, include the cHEAP.h header file in your project and link it with the cHEAP.c implementation file. Then, you can call the provided memory management functions as needed.

heap-management-system's People

Contributors

suryaanything avatar

Stargazers

Houssem Lahmer avatar  avatar

Watchers

 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.