mirror of
				https://github.com/LadybirdBrowser/ladybird.git
				synced 2025-10-31 05:10:57 +00:00 
			
		
		
		
	
		
			
	
	
		
			29 lines
		
	
	
	
		
			445 B
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			29 lines
		
	
	
	
		
			445 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(); | ||
|  |     ~BlockAllocator(); | ||
|  | 
 | ||
|  |     void* allocate_block(char const* name); | ||
|  |     void deallocate_block(void*); | ||
|  | 
 | ||
|  | private: | ||
|  |     static constexpr size_t max_cached_blocks = 64; | ||
|  | 
 | ||
|  |     Vector<void*> m_blocks; | ||
|  | }; | ||
|  | 
 | ||
|  | } |