diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-12-21 21:55:59 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-12-21 21:55:59 +0200 |
| commit | 706b99e3bda688c9adc9a70bb95b96bce1146f57 (patch) | |
| tree | b5acfcf1d9e5cf77676683ad429bc88fe13c89f9 | |
| parent | 452cab52de2107c1ce8c7eb0883ff80bb80ac76b (diff) | |
| download | gran-706b99e3bda688c9adc9a70bb95b96bce1146f57.tar.gz gran-706b99e3bda688c9adc9a70bb95b96bce1146f57.zip | |
check for leaked memory
| -rwxr-xr-x | scripts/gen-report | 4 | ||||
| -rw-r--r-- | src/cpu/riscv/simt_riscv64.c | 16 |
2 files changed, 19 insertions, 1 deletions
diff --git a/scripts/gen-report b/scripts/gen-report index 38e4a47..9b86174 100755 --- a/scripts/gen-report +++ b/scripts/gen-report @@ -13,6 +13,8 @@ shift $((OPTIND - 1)) for p in "$@"; do mkdir -p "reports/${p}" - timeout --foreground 30s valgrind -q --error-exitcode=1 \ + timeout --foreground 30s valgrind -q \ + --leak-check=full \ + --error-exitcode=1 \ "./${BUILD}/${p}" > "reports/${p}/log" done 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; |
