Started testing the GC
Co-authored-by: ValterMiari <ValterMiari@users.noreply.github.com>
This commit is contained in:
parent
f8d761411d
commit
c05bf76662
7 changed files with 188 additions and 65 deletions
30
src/GC/tests/linker.cpp
Normal file
30
src/GC/tests/linker.cpp
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "heap.hpp"
|
||||
|
||||
struct Obj {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
};
|
||||
|
||||
int main() {
|
||||
auto heap = GC::Heap::the2();
|
||||
|
||||
std::cout << "heap:\t" << heap << std::endl;
|
||||
|
||||
auto obj = static_cast<Obj *>(heap->alloc(sizeof(Obj)));
|
||||
|
||||
std::cout << "obj: \t" << obj << std::endl;
|
||||
|
||||
obj->a = 3;
|
||||
obj->b = 4;
|
||||
obj->c = 5;
|
||||
|
||||
std::cout << obj->a << ", " << obj->b << ", " << obj->c << std::endl;
|
||||
|
||||
heap->print_contents();
|
||||
//delete heap;
|
||||
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue