File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -65,7 +65,7 @@ namespace snmalloc
6565 */
6666 DecommitNone,
6767 /* *
68- * Decommit superslabs when they are no entirely empty.
68+ * Decommit superslabs when they are entirely empty.
6969 */
7070 DecommitSuper,
7171 /* *
Original file line number Diff line number Diff line change @@ -91,6 +91,10 @@ namespace snmalloc
9191 for (size_t large_class = 0 ; large_class < NUM_LARGE_CLASSES ;
9292 large_class++)
9393 {
94+ if (!PAL::expensive_low_memory_check ())
95+ {
96+ break ;
97+ }
9498 size_t rsize = ((size_t )1 << SUPERSLAB_BITS ) << large_class;
9599 size_t decommit_size = rsize - OS_PAGE_SIZE ;
96100 // Grab all of the chunks of this size class.
@@ -112,7 +116,6 @@ namespace snmalloc
112116 slab = next;
113117 }
114118 }
115-
116119 lazy_decommit_guard.clear ();
117120 }
118121
@@ -218,9 +221,12 @@ namespace snmalloc
218221 // update) let them win.
219222 do
220223 {
221- last_low_memory_epoch.compare_exchange_strong (old_epoch, new_epoch);
224+ if (last_low_memory_epoch.compare_exchange_strong (
225+ old_epoch, new_epoch))
226+ {
227+ lazy_decommit ();
228+ }
222229 } while (old_epoch <= new_epoch);
223- lazy_decommit ();
224230 }
225231 }
226232#endif
You can’t perform that action at this time.
0 commit comments