Skip to content

Practical implementation of memory management simulation in C

License

Notifications You must be signed in to change notification settings

nithinbharathi/Malloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Malloc

This project provides a simple memory management simulation in C. It demonstrates basic memory allocation and deallocation mechanisms using a fixed-size heap. The implementation also includes an additional functionality for tracking and merging memory blocks to optimize space utilization. The key features include memory allocation, memory deallocation, and merging contiguous free blocks to optimize memroy usage.

The following example demonstrates allocation and deallocation of memory blocks, and prints the state of allocated and free memory blocks:

for (int i = 0; i < 5; i++) {             //allocates memory blocks of size 0 to 4
    void* allocated_address = allocate(i);
    deallocate(allocated_address);        //deallocates the allocated memory addresses
  }
  
trace_heap();              // prints out the current state of the heap (allocated and free blocks information)

About

Practical implementation of memory management simulation in C

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages