PoolChunked.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9#ifndef _MEM_POOL_CHUNKED_H_
10#define _MEM_POOL_CHUNKED_H_
11
12#include "mem/Pool.h"
13#include "splay.h"
14
15#define MEM_CHUNK_SIZE 4 * 4096 /* 16KB ... 4 * VM_PAGE_SZ */
16#define MEM_CHUNK_MAX_SIZE 256 * 1024 /* 2MB */
17
18class MemChunk;
19
22{
23public:
24 friend class MemChunk;
25 MemPoolChunked(const char *label, size_t obj_size);
28 virtual void clean(time_t maxage);
29
34 virtual int getStats(MemPoolStats * stats, int accumulate);
35
36 void createChunk();
37 void *get();
38 void push(void *obj);
39 virtual int getInUseCount();
40protected:
41 virtual void *allocate();
42 virtual void deallocate(void *, bool aggressive);
43public:
54 virtual void setChunkSize(size_t chunksize);
55
56 virtual bool idleTrigger(int shift) const;
57
58 size_t chunk_size;
61 void *freeCache;
65};
66
69{
70public:
72 ~MemChunk();
73 void *freeList;
74 void *objCache;
78 time_t lastref;
80};
81
82#endif /* _MEM_POOL_CHUNKED_H_ */
83
const char * label
Definition: Pool.h:236
int inuse_count
Definition: PoolChunked.h:75
time_t lastref
Definition: PoolChunked.h:78
MemChunk * next
Definition: PoolChunked.h:77
void * objCache
Definition: PoolChunked.h:74
MemChunk * nextFreeChunk
Definition: PoolChunked.h:76
MemPoolChunked * pool
Definition: PoolChunked.h:79
MemChunk(MemPoolChunked *pool)
Definition: PoolChunked.cc:100
void * freeList
Definition: PoolChunked.h:73
void createChunk()
Definition: PoolChunked.cc:221
void push(void *obj)
Definition: PoolChunked.cc:159
void convertFreeCacheToChunkFreeCache()
Definition: PoolChunked.cc:327
void * freeCache
Definition: PoolChunked.h:61
MemChunk * nextFreeChunk
Definition: PoolChunked.h:62
virtual void setChunkSize(size_t chunksize)
Definition: PoolChunked.cc:252
virtual bool idleTrigger(int shift) const
Definition: PoolChunked.cc:417
Splay< MemChunk * > allChunks
Definition: PoolChunked.h:64
virtual void clean(time_t maxage)
Definition: PoolChunked.cc:353
virtual void * allocate()
Definition: PoolChunked.cc:308
virtual void deallocate(void *, bool aggressive)
Definition: PoolChunked.cc:318
MemPoolChunked(const char *label, size_t obj_size)
Definition: PoolChunked.cc:137
MemChunk * Chunks
Definition: PoolChunked.h:63
virtual int getStats(MemPoolStats *stats, int accumulate)
Definition: PoolChunked.cc:426
virtual int getInUseCount()
Definition: PoolChunked.cc:302
size_t chunk_size
Definition: PoolChunked.h:58
class Ping::pingStats_ stats

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors