Skip to content

Commit

Permalink
Release address space on thread exit (#1188)
Browse files Browse the repository at this point in the history
The destructor for arena now munmap()s any mapped address space. This is
aimed at threads that may exit while the address space remains active
for other threads.
  • Loading branch information
stevenmeker authored Dec 13, 2024
1 parent 3c2819a commit 09262f4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions include/runtime/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <sys/mman.h>
#include <sys/types.h>
#include <utility>

Expand All @@ -22,6 +23,12 @@ class arena {
initialize_semispace();
}

~arena() {
munmap(current_addr_ptr, HYPERBLOCK_SIZE);
if (collection_addr_ptr)
munmap(collection_addr_ptr, HYPERBLOCK_SIZE);
}

char *evacuate(char *scan_ptr);

// Allocates the requested number of bytes as a contiguous region and returns a
Expand Down

0 comments on commit 09262f4

Please sign in to comment.