AllocatorProxy.cc
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#include "squid.h"
10#include "mem/Allocator.h"
11#include "mem/AllocatorProxy.h"
12#include "mem/Pool.h"
13#include "mem/Stats.h"
14
15void *
17{
18 return getAllocator()->alloc();
19}
20
21void
23{
24 getAllocator()->freeOne(address);
25 /* TODO: check for empty, and if so, if the default type has altered,
26 * switch
27 */
28}
29
32{
33 if (!theAllocator) {
34 theAllocator = MemPools::GetInstance().create(objectType(), size);
35 theAllocator->zeroBlocks(doZero);
36 }
37 return theAllocator;
38}
39
40int
42{
43 if (!theAllocator)
44 return 0;
45 else
46 return theAllocator->getInUseCount();
47}
48
49void
51{
52 getAllocator()->zeroBlocks(doIt);
53}
54
55void
56Mem::AllocatorProxy::relabel(const char * const aLabel)
57{
58 getAllocator()->relabel(aLabel);
59 label = aLabel;
60}
61
62Mem::PoolMeter const &
64{
65 return getAllocator()->meter;
66}
67
68size_t
70{
71 return getAllocator()->getStats(stats);
72}
73
int size
Definition: ModDevPoll.cc:75
Mem::Allocator * create(const char *, size_t)
Definition: Pool.cc:47
static MemPools & GetInstance()
Definition: Pool.cc:27
void * alloc()
Allocate one element from the pool.
void relabel(const char *const aLabel)
void freeOne(void *)
Free a element allocated by Mem::AllocatorProxy::alloc()
Allocator * getAllocator() const
void zeroBlocks(bool doIt)
int inUseCount() const
size_t getStats(PoolStats &stats)
PoolMeter const & getMeter() const
void zeroBlocks(const bool doIt)
Definition: Allocator.h:62
void * alloc()
provide (and reserve) memory suitable for storing one object
Definition: Allocator.h:44
class Ping::pingStats_ stats

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors