Skip to content

Commit d6e89b7

Browse files
committed
Fix Matt's code review comments.
1 parent 01bd77b commit d6e89b7

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

src/mem/allocconfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
/**

src/mem/largealloc.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)