Commit 58cc21c 1 parent c44940e commit 58cc21c Copy full SHA for 58cc21c
File tree 1 file changed +11
-5
lines changed
1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -122,12 +122,18 @@ namespace alaska {
122
122
123
123
124
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);
125
+ long extended_count = 0 ;
126
+ off_t start = (off_t )bump_next;
127
+ off_t end = start + object_size * count;
128
+ if (end > (off_t )objects_end) end = (off_t )objects_end;
129
+ bump_next = (void *)end;
130
+
131
+ for (off_t o = end - object_size; o >= start; o -= object_size) {
132
+ free_list.free_local ((void *)o);
133
+ extended_count++;
129
134
}
130
- return e;
135
+
136
+ return extended_count;
131
137
}
132
138
133
139
You can’t perform that action at this time.
0 commit comments