ladybird/Userland/Libraries/LibJS/Heap/BlockAllocator.h
Lenny Maiorani d00b79568f Libraries: Use default constructors/destructors in LibJS
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-03-16 16:19:40 +00:00

28 lines
475 B
C++

/*
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Vector.h>
#include <LibJS/Forward.h>
namespace JS {
class BlockAllocator {
public:
BlockAllocator() = default;
~BlockAllocator();
void* allocate_block(char const* name);
void deallocate_block(void*);
private:
static constexpr size_t max_cached_blocks = 512;
Vector<void*, max_cached_blocks> m_blocks;
};
}