File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,20 @@ class arena {
111111 // allocated within an arena.
112112 static char get_arena_semispace_id_of_object (void *ptr);
113113
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+
114128private:
115129 void initialize_semispace ();
116130 //
Original file line number Diff line number Diff line change 1212extern " C" {
1313extern thread_local arena youngspace;
1414extern thread_local arena oldspace;
15+ extern thread_local arena alwaysgcspace;
1516
1617char *youngspace_ptr (void );
1718char *oldspace_ptr (void );
@@ -345,5 +346,8 @@ void kore_collect(
345346void free_all_kore_mem () {
346347 kore_collect (nullptr , 0 , nullptr , true );
347348 kore_clear ();
349+ youngspace.munmap_arena_and_reset ();
350+ oldspace.munmap_arena_and_reset ();
351+ alwaysgcspace.munmap_arena_and_reset ();
348352}
349353}
You can’t perform that action at this time.
0 commit comments