aboutsummaryrefslogtreecommitdiff
path: root/src/cpu/riscv
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2025-12-21 21:55:59 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2025-12-21 21:55:59 +0200
commit706b99e3bda688c9adc9a70bb95b96bce1146f57 (patch)
treeb5acfcf1d9e5cf77676683ad429bc88fe13c89f9 /src/cpu/riscv
parent452cab52de2107c1ce8c7eb0883ff80bb80ac76b (diff)
downloadgran-706b99e3bda688c9adc9a70bb95b96bce1146f57.tar.gz
gran-706b99e3bda688c9adc9a70bb95b96bce1146f57.zip
check for leaked memory
Diffstat (limited to 'src/cpu/riscv')
-rw-r--r--src/cpu/riscv/simt_riscv64.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/cpu/riscv/simt_riscv64.c b/src/cpu/riscv/simt_riscv64.c
index 68e87a5..d6a002b 100644
--- a/src/cpu/riscv/simt_riscv64.c
+++ b/src/cpu/riscv/simt_riscv64.c
@@ -226,6 +226,21 @@ static stat simt_riscv64_clock(struct simt_riscv64 *c)
return r;
}
+static void simt_riscv64_destroy(struct simt_riscv64 *c)
+{
+ foreach(lanes, core, &c->lanes) {
+ if ((*core)->destroy)
+ (*core)->destroy(*core);
+ else
+ free(*core);
+ }
+
+ lanes_destroy(&c->lanes);
+ reqs_destroy(&c->data_rqs);
+ reqs_destroy(&c->inst_rqs);
+ free(c);
+}
+
struct component *create_simt_riscv64(
struct simt_riscv64_conf conf,
struct component *imem,
@@ -236,6 +251,7 @@ struct component *create_simt_riscv64(
return NULL;
new->component.clock = (clock_callback)simt_riscv64_clock;
+ new->component.destroy = (destroy_callback)simt_riscv64_destroy;
new->conf = conf;
new->imem = imem;