1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:37:35 +00:00

Revert "LibC: Simplify malloc size classes"

This reverts commit f91bcb8895.
This commit is contained in:
Andreas Kling 2021-05-18 08:32:05 +02:00
parent f5c4d86592
commit 7957f13e98
3 changed files with 18 additions and 12 deletions

View file

@ -102,12 +102,12 @@ struct BigAllocator {
// are run. Similarly, we can not allow global destructors to destruct
// them. We could have used AK::NeverDestoyed to prevent the latter,
// but it would have not helped with the former.
static u8 g_allocators_storage[sizeof(Allocator) * size_classes.size()];
static u8 g_allocators_storage[sizeof(Allocator) * num_size_classes];
static u8 g_big_allocators_storage[sizeof(BigAllocator)];
static inline Allocator (&allocators())[size_classes.size()]
static inline Allocator (&allocators())[num_size_classes]
{
return reinterpret_cast<Allocator(&)[size_classes.size()]>(g_allocators_storage);
return reinterpret_cast<Allocator(&)[num_size_classes]>(g_allocators_storage);
}
static inline BigAllocator (&big_allocators())[1]
@ -442,7 +442,7 @@ void __malloc_init()
if (secure_getenv("LIBC_PROFILE_MALLOC"))
s_profiling = true;
for (size_t i = 0; i < size_classes.size(); ++i) {
for (size_t i = 0; i < num_size_classes; ++i) {
new (&allocators()[i]) Allocator();
allocators()[i].size = size_classes[i];
}