]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mem/AllocatorProxy.cc
SourceFormat Enforcement
[thirdparty/squid.git] / src / mem / AllocatorProxy.cc
CommitLineData
eac61ce1 1/*
bde978a6 2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
eac61ce1
AJ
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
ed6e9fb9
AJ
9#include "squid.h"
10#include "mem/AllocatorProxy.h"
11#include "mem/Pool.h"
12
13void *
14Mem::AllocatorProxy::alloc()
15{
16 return getAllocator()->alloc();
17}
18
19void
20Mem::AllocatorProxy::freeOne(void *address)
21{
22 getAllocator()->freeOne(address);
23 /* TODO: check for empty, and if so, if the default type has altered,
24 * switch
25 */
26}
27
28MemAllocator *
29Mem::AllocatorProxy::getAllocator() const
30{
31 if (!theAllocator)
32 theAllocator = MemPools::GetInstance().create(objectType(), size);
33 return theAllocator;
34}
35
36int
37Mem::AllocatorProxy::inUseCount() const
38{
39 if (!theAllocator)
40 return 0;
41 else
42 return memPoolInUseCount(theAllocator);
43}
44
45MemPoolMeter const &
46Mem::AllocatorProxy::getMeter() const
47{
48 return getAllocator()->getMeter();
49}
50
51int
52Mem::AllocatorProxy::getStats(MemPoolStats * stats)
53{
54 return getAllocator()->getStats(stats);
55}
f53969cc 56