blob: 953a5edbd85241a3d9d1a4ae38ee6b7572e87836 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
From 88242bebd8381deef7598470ed74c23dbffaacb4 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <ali.mpfard@gmail.com>
Date: Fri, 11 Feb 2022 18:29:07 +0330
Subject: [PATCH 7/9] Disable GC on serenity
---
src/memory.c | 4 ++++
src/system.c | 3 +++
2 files changed, 7 insertions(+)
diff --git a/src/memory.c b/src/memory.c
index f221e06..974bbe6 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -91,6 +91,7 @@ void* ctr_heap_allocate(size_t size)
/* Check whether we can afford to allocate this much */
ctr_gc_alloc = GC_get_heap_size() - GC_get_free_bytes() - GC_get_unmapped_bytes();
+#ifndef __serenity__
if (ctr_gc_memlimit < ctr_gc_alloc) {
ctr_gc_sweep(0);
if (ctr_gc_memlimit < ctr_gc_alloc) {
@@ -104,6 +105,7 @@ void* ctr_heap_allocate(size_t size)
}
}
}
+#endif
/* Perform allocation and check result */
slice_of_memory = calloc(size, 1);
@@ -225,10 +227,12 @@ size_t ctr_heap_get_latest_tracking_id() { return numberOfMemBlocks - 1; }
*/
void ctr_heap_free_rest()
{
+#ifndef __serenity__
size_t i;
for (i = 0; i < numberOfMemBlocks; i++) {
ctr_heap_free(memBlocks[i].space);
}
+#endif
}
/**
diff --git a/src/system.c b/src/system.c
index e42d09a..a6856b8 100644
--- a/src/system.c
+++ b/src/system.c
@@ -426,6 +426,9 @@ void ctr_gc_mark(ctr_object* object, int last_vector_index)
*/
void ctr_gc_sweep(int all)
{
+#ifdef __serenity
+ return;
+#endif
ctr_object* previousObject = NULL;
ctr_object* currentObject = ctr_first_object;
ctr_object* nextObject = NULL;
--
2.34.1
|