File tree 2 files changed +18
-0
lines changed
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,20 @@ class arena {
111
111
// allocated within an arena.
112
112
static char get_arena_semispace_id_of_object (void *ptr);
113
113
114
+ // Unmaps the current and collection address spaces and resets them and the tripwire.
115
+ // This is needed when the client switches thread contexts without properly deallocating
116
+ // them. This is not a common use case and shoul be used carefully.
117
+ void munmap_arena_and_reset () {
118
+ if (current_addr_ptr)
119
+ munmap (current_addr_ptr, HYPERBLOCK_SIZE);
120
+ if (collection_addr_ptr)
121
+ munmap (collection_addr_ptr, HYPERBLOCK_SIZE);
122
+
123
+ current_addr_ptr = nullptr ;
124
+ collection_addr_ptr = nullptr ;
125
+ tripwire = nullptr ;
126
+ }
127
+
114
128
private:
115
129
void initialize_semispace ();
116
130
//
Original file line number Diff line number Diff line change 12
12
extern " C" {
13
13
extern thread_local arena youngspace;
14
14
extern thread_local arena oldspace;
15
+ extern thread_local arena alwaysgcspace;
15
16
16
17
char *youngspace_ptr (void );
17
18
char *oldspace_ptr (void );
@@ -345,5 +346,8 @@ void kore_collect(
345
346
void free_all_kore_mem () {
346
347
kore_collect (nullptr , 0 , nullptr , true );
347
348
kore_clear ();
349
+ youngspace.munmap_arena_and_reset ();
350
+ oldspace.munmap_arena_and_reset ();
351
+ alwaysgcspace.munmap_arena_and_reset ();
348
352
}
349
353
}
You can’t perform that action at this time.
0 commit comments