PoolChunked.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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 
18 class MemChunk;
19 
22 {
23 public:
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();
40 protected:
41  virtual void *allocate();
42  virtual void deallocate(void *, bool aggressive);
43 public:
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 
68 class MemChunk
69 {
70 public:
72  ~MemChunk();
73  void *freeList;
74  void *objCache;
78  time_t lastref;
80 };
81 
82 #endif /* _MEM_POOL_CHUNKED_H_ */
83 
virtual int getInUseCount()
Definition: PoolChunked.cc:303
virtual int getStats(MemPoolStats *stats, int accumulate)
Definition: PoolChunked.cc:427
MemChunk * nextFreeChunk
Definition: PoolChunked.h:76
MemChunk * nextFreeChunk
Definition: PoolChunked.h:62
class Ping::pingStats_ stats
const char * label
Definition: Pool.h:236
int inuse_count
Definition: PoolChunked.h:75
virtual bool idleTrigger(int shift) const
Definition: PoolChunked.cc:418
MemPoolChunked(const char *label, size_t obj_size)
Definition: PoolChunked.cc:138
MemPoolChunked * pool
Definition: PoolChunked.h:79
virtual void setChunkSize(size_t chunksize)
Definition: PoolChunked.cc:253
MemChunk * next
Definition: PoolChunked.h:77
void * objCache
Definition: PoolChunked.h:74
virtual void deallocate(void *, bool aggressive)
Definition: PoolChunked.cc:319
void * freeCache
Definition: PoolChunked.h:61
MemChunk * Chunks
Definition: PoolChunked.h:63
void * freeList
Definition: PoolChunked.h:73
MemChunk(MemPoolChunked *pool)
Definition: PoolChunked.cc:101
void createChunk()
Definition: PoolChunked.cc:222
virtual void * allocate()
Definition: PoolChunked.cc:309
size_t chunk_size
Definition: PoolChunked.h:58
time_t lastref
Definition: PoolChunked.h:78
Splay< MemChunk * > allChunks
Definition: PoolChunked.h:64
void push(void *obj)
Definition: PoolChunked.cc:160
void convertFreeCacheToChunkFreeCache()
Definition: PoolChunked.cc:328
virtual void clean(time_t maxage)
Definition: PoolChunked.cc:354

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors