Skip to content

Commit

Permalink
deleted free_all_memory(), global variable hyperblock_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenmeker committed Nov 19, 2024
1 parent 9f646a6 commit b24b521
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
11 changes: 5 additions & 6 deletions include/runtime/arena.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ class arena {
public:
arena(char id)
: allocation_semispace_id(id) { }

// Allocates the requested number of bytes as a contiguous region and returns a
// pointer to the first allocated byte.
// If called with requested size greater than the maximun single allocation
// size, the space is allocated in a general (not garbage collected pool).
void *kore_arena_alloc(size_t requested);

// Returns the address of the first byte that belongs in the given arena.
Expand Down Expand Up @@ -114,10 +119,6 @@ extern thread_local bool time_for_collection;

size_t get_gc_threshold();

// Allocates the requested number of bytes as a contiguous region and returns a
// pointer to the first allocated byte.
// If called with requested size greater than the maximun single allocation
// size, the space is allocated in a general (not garbage collected pool).
inline void *arena::kore_arena_alloc(size_t requested) {
if (block + requested > block_end) {
return do_alloc_slow(requested);
Expand All @@ -130,8 +131,6 @@ inline void *arena::kore_arena_alloc(size_t requested) {
return result;
}

// Deallocates all the memory allocated for registered arenas.
void free_all_memory(void);
}

#endif // ARENA_H
9 changes: 0 additions & 9 deletions runtime/alloc/arena.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ arena::get_arena_semispace_id_of_object(void *ptr) {
// We will reserve enough address space for 1 million 1MB blocks. Might want to increase this on a > 1TB server.
//
size_t const HYPERBLOCK_SIZE = (size_t)BLOCK_SIZE * 1024 * 1024;
static thread_local void *hyperblock_ptr = nullptr; // only needed for munmap()

static void *megabyte_malloc() {
//
Expand Down Expand Up @@ -64,7 +63,6 @@ static void *megabyte_malloc() {
perror("mmap()");
abort();
}
hyperblock_ptr = addr;
//
// We ask for one block worth of address space less than we allocated so alignment will always succeed.
// We don't worry about unused address space either side of our aligned address space because there will be no
Expand All @@ -76,13 +74,6 @@ static void *megabyte_malloc() {
return currentblock_ptr;
}

void free_all_memory() {
//
// Frees all memory that was demand paged into this address range.
//
munmap(hyperblock_ptr, HYPERBLOCK_SIZE);
}

#ifdef __MACH__
//
// thread_local disabled for Apple
Expand Down

0 comments on commit b24b521

Please sign in to comment.