1
Files
lecture-operating-system-de…/c_os/kernel/allocator/BumpAllocator.h
2022-05-07 14:30:40 +02:00

35 lines
1.2 KiB
C++
Executable File

/*****************************************************************************
* *
* B U M P A L L O C A T O R *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Eine sehr einfache Heap-Verwaltung, welche freigegebenen *
* Speicher nicht mehr nutzen kann. *
* *
* Autor: Michael Schoettner, HHU, 3.3.2022 *
*****************************************************************************/
#ifndef __BumpAllocator_include__
#define __BumpAllocator_include__
#include "kernel/Allocator.h"
class BumpAllocator : Allocator {
private:
unsigned char* next;
unsigned int allocations;
BumpAllocator(Allocator& copy); // Verhindere Kopieren
public:
BumpAllocator() {}; // Allocator() called implicitely in C++
void init();
void dump_free_memory();
void* alloc(unsigned int req_size);
void free(void* ptr);
};
#endif