switch to linkedlistallocator + demo
This commit is contained in:
@ -15,5 +15,5 @@ PCSPK pcspk; // PC-Lautsprecher
|
||||
CGA_Stream kout; // Ausgabe-Strom fuer Kernel
|
||||
Keyboard kb; // Tastatur
|
||||
unsigned int total_mem; // RAM total
|
||||
BumpAllocator allocator;
|
||||
//LinkedListAllocator allocator;
|
||||
// BumpAllocator allocator;
|
||||
LinkedListAllocator allocator;
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "devices/Keyboard.h"
|
||||
#include "devices/PCSPK.h"
|
||||
#include "kernel/allocator/BumpAllocator.h"
|
||||
#include "kernel/allocator/LinkedListAllocator.h"
|
||||
#include "kernel/CPU.h"
|
||||
|
||||
extern CPU cpu; // CPU-spezifische Funktionen
|
||||
@ -21,7 +22,7 @@ extern PCSPK pcspk; // PC-Lautsprecher
|
||||
extern CGA_Stream kout; // Ausgabe-Strom fuer Kernel
|
||||
extern Keyboard kb; // Tastatur
|
||||
extern unsigned int total_mem; // RAM total
|
||||
extern BumpAllocator allocator;
|
||||
//extern LinkedListAllocator allocator;
|
||||
// extern BumpAllocator allocator;
|
||||
extern LinkedListAllocator allocator;
|
||||
|
||||
#endif
|
||||
|
@ -32,9 +32,6 @@ void heap_demo() {
|
||||
MyObj* a = new MyObj(5);
|
||||
allocator.dump_free_memory();
|
||||
|
||||
MyObj* b = new MyObj(10);
|
||||
allocator.dump_free_memory();
|
||||
|
||||
allocator.alloc(1024 * 1024); // should fail as only 1024 * 1024 - (4 + 4) bytes remain
|
||||
allocator.alloc(1024 * 1024 - 16); // should fail as only 1024 * 1024 - (4 + 4) bytes remain
|
||||
allocator.dump_free_memory();
|
||||
}
|
||||
|
Reference in New Issue
Block a user