PoolMalloc.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 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 SQUID_SRC_MEM_POOLMALLOC_H
10 #define SQUID_SRC_MEM_POOLMALLOC_H
11 
31 #include "mem/Allocator.h"
32 
33 #include <stack>
34 
37 {
38 public:
39  MemPoolMalloc(char const *label, size_t aSize);
40  ~MemPoolMalloc() override;
41 
42  /* Mem::Allocator API */
43  size_t getStats(Mem::PoolStats &) override;
44  bool idleTrigger(int) const override;
45  void clean(time_t) override;
46 
47 protected:
48  /* Mem::Allocator API */
49  void *allocate() override;
50  void deallocate(void *) override;
51 
52 private:
53  std::stack<void *> freelist;
54 };
55 
56 #endif /* SQUID_SRC_MEM_POOLMALLOC_H */
57 
std::stack< void * > freelist
Definition: PoolMalloc.h:53
void deallocate(void *) override
freeOne(void *)
Definition: PoolMalloc.cc:50
~MemPoolMalloc() override
Definition: PoolMalloc.cc:89
const char * label
brief description of objects returned by alloc()
Definition: Allocator.h:109
MemPoolMalloc(char const *label, size_t aSize)
Definition: PoolMalloc.cc:84
void * allocate() override
*alloc()
Definition: PoolMalloc.cc:24
void clean(time_t) override
Definition: PoolMalloc.cc:102
size_t getStats(Mem::PoolStats &) override
Definition: PoolMalloc.cc:67
bool idleTrigger(int) const override
Definition: PoolMalloc.cc:96

 

Introduction

Documentation

Support

Miscellaneous