]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/mem/minimal.cc
2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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.
10 #include "mem/AllocatorProxy.h"
11 #include "mem/forward.h"
13 /// The number of currently alive objects (poor man's meter.alloc=meter.inuse).
14 /// Technically, this is supposed to be a per-allocator statistics, but
15 /// AllocatorProxy is not a Mem::Allocator so we maintain a global counter
16 /// instead. We probably do not have to maintain this statistics at all.
20 Mem::AllocatorProxy::alloc()
22 const auto memory
= doZero
? xcalloc(1, size
) : xmalloc(size
);
28 Mem::AllocatorProxy::freeOne(void *memory
) {
34 Mem::AllocatorProxy::inUseCount() const
40 Mem::AllocatorProxy::getStats(PoolStats
&)
46 memAllocBuf(const size_t netSize
, size_t * const grossSize
)
49 return xcalloc(1, netSize
);
53 memReallocBuf(void * const oldBuf
, const size_t netSize
, size_t * const grossSize
)
56 return xrealloc(oldBuf
, netSize
);
60 memFree(void *memory
, int)
66 memAllocString(const size_t netSize
, size_t * const grossSize
)
68 return memAllocBuf(netSize
, grossSize
);
72 memFreeString(size_t, void *memory
)
78 memAllocRigid(const size_t netSize
)
80 return xmalloc(netSize
);
84 memFreeBuf(size_t, void * const buf
)
90 myFree(void * const buf
)
96 memFreeBufFunc(size_t)