]>
Commit | Line | Data |
---|---|---|
ed6e9fb9 | 1 | /* |
bf95c10a | 2 | * Copyright (C) 1996-2022 The Squid Software Foundation and contributors |
ed6e9fb9 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 | ||
9 | #include "squid.h" | |
10 | ||
11 | #define STUB_API "mem/libmem.la" | |
44e802f4 | 12 | #include "tests/STUB.h" |
ed6e9fb9 | 13 | |
341876ec AJ |
14 | #include "mem/Allocator.h" |
15 | ||
ed6e9fb9 | 16 | #include "mem/AllocatorProxy.h" |
8b082ed9 FC |
17 | #include "mem/forward.h" |
18 | ||
ed6e9fb9 AJ |
19 | void *Mem::AllocatorProxy::alloc() {return xmalloc(64*1024);} |
20 | void Mem::AllocatorProxy::freeOne(void *address) {xfree(address);} | |
21 | int Mem::AllocatorProxy::inUseCount() const {return 0;} | |
09c020f2 | 22 | //Mem::PoolMeter const &Mem::AllocatorProxy::getMeter() const STUB_RETSTATREF(PoolMeter) |
a7508376 | 23 | size_t Mem::AllocatorProxy::getStats(PoolStats &) STUB_RETVAL(0) |
ed6e9fb9 AJ |
24 | |
25 | #include "mem/forward.h" | |
26 | void Mem::Init() STUB_NOP | |
ed6e9fb9 | 27 | void Mem::Stats(StoreEntry *) STUB_NOP |
8b082ed9 FC |
28 | void Mem::CleanIdlePools(void *) STUB_NOP |
29 | void Mem::Report(std::ostream &) STUB_NOP | |
a7508376 | 30 | void Mem::PoolReport(const PoolStats *, const PoolMeter *, std::ostream &) STUB_NOP |
ed6e9fb9 AJ |
31 | //const size_t squidSystemPageSize = 4096; |
32 | void memClean(void) STUB | |
33 | void memInitModule(void) STUB | |
34 | void memCleanModule(void) STUB | |
35 | void memConfigure(void) STUB | |
36 | ||
8b082ed9 | 37 | void *memAllocate(mem_type) |
ed6e9fb9 AJ |
38 | { |
39 | // let's waste plenty of memory. This should cover any possible need | |
40 | return xmalloc(64*1024); | |
41 | } | |
42 | ||
43 | void *memAllocString(size_t net_size, size_t * gross_size) {return memAllocBuf(net_size, gross_size);} | |
44 | ||
c3b51d64 EB |
45 | void *memAllocRigid(size_t net_size) |
46 | { | |
47 | return xmalloc(net_size); | |
48 | } | |
49 | ||
ed6e9fb9 AJ |
50 | void * |
51 | memAllocBuf(size_t net_size, size_t * gross_size) | |
52 | { | |
53 | *gross_size=net_size; | |
54 | return xcalloc(1, net_size); | |
55 | } | |
56 | ||
57 | /* net_size is the new size, *gross size is the old gross size, to be changed to | |
58 | * the new gross size as a side-effect. | |
59 | */ | |
60 | void * | |
61 | memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size) | |
62 | { | |
63 | void *rv=xrealloc(oldbuf,net_size); | |
64 | // if (net_size > *gross_size) | |
65 | // memset(rv+net_size,0,net_size-*gross_size); | |
66 | *gross_size=net_size; | |
67 | return rv; | |
68 | } | |
69 | ||
70 | void memFree(void *p, int) {xfree(p);} | |
71 | void memFreeString(size_t, void *buf) {xfree(buf);} | |
c3b51d64 | 72 | void memFreeRigid(void *buf, size_t) {xfree(buf);} |
ed6e9fb9 AJ |
73 | void memFreeBuf(size_t, void *buf) {xfree(buf);} |
74 | static void cxx_xfree(void * ptr) {xfree(ptr);} | |
75 | FREE *memFreeBufFunc(size_t) {return cxx_xfree;} | |
76 | int memInUse(mem_type) STUB_RETVAL(0) | |
77 | void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP | |
78 | void memCheckInit(void) STUB_NOP | |
79 | ||
80 | #include "mem/Pool.h" | |
ed6e9fb9 AJ |
81 | static MemPools tmpMemPools; |
82 | MemPools &MemPools::GetInstance() {return tmpMemPools;} | |
81e5e253 | 83 | MemPools::MemPools() STUB_NOP |
ed6e9fb9 | 84 | void MemPools::flushMeters() STUB |
72ed5979 | 85 | MemImplementingAllocator * MemPools::create(const char *, size_t) STUB_RETVAL(nullptr); |
72ed5979 | 86 | void MemPools::clean(time_t) STUB |
ed6e9fb9 AJ |
87 | void MemPools::setDefaultPoolChunking(bool const &) STUB |
88 | ||
72ed5979 | 89 | //MemImplementingAllocator::MemImplementingAllocator(char const *, size_t) STUB_NOP |
09c020f2 AJ |
90 | Mem::PoolMeter const &MemImplementingAllocator::getMeter() const STUB_RETSTATREF(PoolMeter) |
91 | Mem::PoolMeter &MemImplementingAllocator::getMeter() STUB_RETSTATREF(PoolMeter) | |
ed6e9fb9 AJ |
92 | void MemImplementingAllocator::flushMetersFull() STUB |
93 | void MemImplementingAllocator::flushMeters() STUB | |
72ed5979 | 94 | void *MemImplementingAllocator::alloc() STUB_RETVAL(nullptr) |
ed6e9fb9 | 95 | void MemImplementingAllocator::freeOne(void *) STUB |
a7508376 | 96 | size_t MemImplementingAllocator::objectSize() const { return obj_size; } |
ed6e9fb9 | 97 | |
a7508376 AJ |
98 | #include "mem/Stats.h" |
99 | size_t Mem::GlobalStats(PoolStats &) STUB_RETVAL(0) |