]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mem/PoolChunked.h
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_SRC_MEM_POOLCHUNKED_H
10 #define SQUID_SRC_MEM_POOLCHUNKED_H
12 #include "mem/Allocator.h"
15 #define MEM_CHUNK_SIZE 4 * 4096 /* 16KB ... 4 * VM_PAGE_SZ */
16 #define MEM_CHUNK_MAX_SIZE 256 * 1024 /* 2MB */
20 /// \ingroup MemPoolsAPI
21 class MemPoolChunked
: public Mem::Allocator
24 friend class MemChunk
;
25 MemPoolChunked(const char *label
, size_t obj_size
);
26 ~MemPoolChunked() override
;
27 void convertFreeCacheToChunkFreeCache();
32 /* Mem::Allocator API */
33 size_t getStats(Mem::PoolStats
&) override
;
34 void setChunkSize(size_t) override
;
35 bool idleTrigger(int) const override
;
36 void clean(time_t) override
;
39 /* Mem::Allocator API */
40 void *allocate() override
;
41 void deallocate(void *) override
;
48 MemChunk
*nextFreeChunk
;
50 Splay
<MemChunk
*> allChunks
;
53 /// \ingroup MemPoolsAPI
57 MemChunk(MemPoolChunked
*pool
);
62 MemChunk
*nextFreeChunk
;
68 #endif /* SQUID_SRC_MEM_POOLCHUNKED_H */