We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c44940e commit d0680c5Copy full SHA for d0680c5
runtime/include/alaska/SizedAllocator.hpp
@@ -122,12 +122,18 @@ namespace alaska {
122
123
124
inline long SizedAllocator::extend(long count) {
125
- long e = 0;
126
- for (; e < count && bump_next != objects_end; e++) {
127
- free_list.free_local(bump_next);
128
- bump_next = (void *)((uintptr_t)bump_next + object_size);
+ long extended_count = 0;
+ off_t start = (off_t)bump_next;
+ off_t end = start + object_size;
+ if (end > (off_t)objects_end) end = (off_t)objects_end;
129
+ bump_next = (void *)end;
130
+
131
+ for (off_t o = end - 1; o >= start; o -= object_size) {
132
+ free_list.free_local((void *)o);
133
+ extended_count++;
134
}
- return e;
135
136
+ return extended_count;
137
138
139
0 commit comments