An open API service indexing awesome lists of open source software.

https://github.com/adilevi25/memorymanageroop

A C++ memory management system using OOP principles
https://github.com/adilevi25/memorymanageroop

allocator cpp data-structures memory-management oop simulation

Last synced: 9 months ago
JSON representation

A C++ memory management system using OOP principles

Awesome Lists containing this project

README

          

# MemoryManagerOOP

This project implements a custom memory management system in C++ using Object-Oriented Programming principles.
It was developed as part of an academic assignment in the Electrical and Electronics Engineering department at Ort Braude College.

## ๐Ÿ“š Project Overview

The system simulates memory allocation using a fixed-size memory pool and supports the following allocation strategies:

- **First Fit**
- **Best Fit**
- **Worst Fit**

Each strategy is implemented in a dedicated class that inherits from a shared abstract base class `MemoryManager`.

## ๐Ÿงฉ Components

- `Block` โ€“ Represents a single memory block in the pool.
- `MemoryManager` โ€“ Abstract base class for managing the memory pool.
- `FirstFitAllocator` / `BestFitAllocator` / `WorstFitAllocator` โ€“ Subclasses implementing allocation algorithms.
- `MemorySimulator` โ€“ Contains simulation scenarios to compare the algorithms.
- `Main.cpp` โ€“ Contains tests and verification for each class and scenario.

## โš™๏ธ Build Instructions

To compile the project using g++:

```bash
g++ -std=c++11 Main.cpp Block.cpp MemoryManager.cpp FirstFitAllocator.cpp BestFitAllocator.cpp WorstFitAllocator.cpp MemorySimulator.cpp -o memory_manager
```

To run:

```bash
./memory_manager
```

> Ensure you are in the directory containing all `.cpp` and `.h` files.

## ๐Ÿงช Testing

The project includes custom test functions within `Main.cpp` to verify:
- Correct block management (allocation, splitting, merging)
- Strategy-specific behavior
- Edge cases and exception handling
- Simulation performance and peak usage

## ๐Ÿ–ผ๏ธ Simulation Output

Here is a sample from the simulator run (First Fit, Best Fit, Worst Fit):

### โœ… Part 1: First Fit & Best Fit Scenarios

![Simulation 1](./ืกื™ืžื•ืœืฆื™ื”%201.png)

### โœ… Part 2: Worst Fit & Summary

![Simulation 2](./ืกื™ืžื•ืœืฆื™ื”%202.png)

## ๐Ÿ‘ค Authors

- Adi Levi โ€“ [LinkedIn](https://www.linkedin.com/in/adi-levi-5008858269/)
- Aviv Friedman - [LinkedIn](https://www.linkedin.com/in/aviv-friedman-38719426b/)

## ๐Ÿ“„ License

This academic project is shared for learning purposes.