AllocatorProxy.cc
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 #include "squid.h"
10 #include "mem/AllocatorProxy.h"
11 #include "mem/Pool.h"
12 
13 void *
15 {
16  return getAllocator()->alloc();
17 }
18 
19 void
21 {
22  getAllocator()->freeOne(address);
23  /* TODO: check for empty, and if so, if the default type has altered,
24  * switch
25  */
26 }
27 
30 {
31  if (!theAllocator) {
32  theAllocator = MemPools::GetInstance().create(objectType(), size);
33  theAllocator->zeroBlocks(doZero);
34  }
35  return theAllocator;
36 }
37 
38 int
40 {
41  if (!theAllocator)
42  return 0;
43  else
44  return theAllocator->inUseCount();
45 }
46 
47 void
49 {
50  getAllocator()->zeroBlocks(doIt);
51 }
52 
53 MemPoolMeter const &
55 {
56  return getAllocator()->getMeter();
57 }
58 
59 int
61 {
62  return getAllocator()->getStats(stats);
63 }
64 
static MemPools & GetInstance()
Definition: Pool.cc:30
int inUseCount() const
MemImplementingAllocator * create(const char *label, size_t obj_size)
Definition: Pool.cc:91
class Ping::pingStats_ stats
void zeroBlocks(bool doIt)
MemPoolMeter const & getMeter() const
void freeOne(void *)
Free a element allocated by Mem::AllocatorProxy::alloc()
MemAllocator * getAllocator() const
int getStats(MemPoolStats *stats)
void zeroBlocks(bool doIt)
Definition: Pool.h:205
void * alloc()
Allocate one element from the pool.
int size
Definition: ModDevPoll.cc:77
virtual void * alloc()=0

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors