-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGarbageCollection.cpp
More file actions
43 lines (39 loc) · 890 Bytes
/
GarbageCollection.cpp
File metadata and controls
43 lines (39 loc) · 890 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//
// Created by mirro on 2019/09/13.
//
#include <iostream>
#include <stdlib.h>
#include "GarbageCollection.h"
using namespace std;
Object_* GarbageCollection::new_() {
Object_* reference = (Object_*)malloc(sizeof(Object_));
if (!reference) {
collect();
reference = (Object_*)malloc(sizeof(Object_));
if (!reference) {
cout << "error : out of memory" << endl;
}
}
return reference;
}
void GarbageCollection::collect() {
/*
mark_from_roots();
sweep();
*/
}
void GarbageCollection::mark_from_roots() {
/*
initialize(worklist);
for (Object_* field : roots) {
Object_* reference = *field;
if (reference && !is_marked(reference)) {
set_marked(reference);
add(worklist, reference);
mark();
}
}
*/
}
void GarbageCollection::mark() {
}