Skip to content

tanndlin/malloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My Malloc

This project implements a custom memory allocator in C, providing functions similar to the standard malloc, and free. The allocator manages memory blocks using a doubly linked list structure, preventing making many syscalls to as memory is allocated and deallocated.

This project was developed soley for learning purposes and should not be used in production code.

Overview

The allocator requests a 8MB chunk of memory via VirtualAlloc syscall and manages this memory internally. It uses a doubly linked list to keep track of allocated and free memory blocks. Each block contains metadata including its size, status (free or allocated), and memory location.

Each memory block is inserted into the linked list in order such that when a block is freed, it can be coalesced with adjacent free blocks to reduce fragmentation.

When allocating memory the allocator searches for the first free block that is large enough to satisfy the request. If a suitable block is found, it is split if necessary, and the requested memory is returned to the user.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages