Started testing the GC

Co-authored-by: ValterMiari <ValterMiari@users.noreply.github.com>
This commit is contained in:
Victor Olin 2023-02-15 16:57:11 +01:00
parent 30a3da3156
commit b168438c14
7 changed files with 188 additions and 65 deletions

View file

@ -1,16 +1,23 @@
#include "../include/heap.hpp"
#include "heap.hpp"
GC::Heap gc;
GC::Heap *gc = GC::Heap::the2();
void init() {
gc = GC::Heap::the(); // pointer to the heap
std::vector<int> live_int_vec(100);
std::vector<int> dead_int_vec(100);
gc.alloc(sizeof(live_int_vec));
gc.alloc(sizeof(dead_int_vec));
std::vector<int> live_int_vec{1, 2, 3, 4, 5};
std::vector<int> dead_int_vec(10, 1);
int *a_ptr;
int a = 10;
a_ptr = &a;
auto temp1 = gc->alloc(sizeof(a_ptr));
auto temp2 = gc->alloc(sizeof(live_int_vec));
auto temp3 = gc->alloc(sizeof(dead_int_vec));
a_ptr = nullptr;
}
int main() {
gc.print_contents();
init();
gc->force_collect();
gc->print_contents();
//delete gc;
return 0;
}