stub_libmem.cc
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2018 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 
11 #define STUB_API "mem/libmem.la"
12 #include "STUB.h"
13 
14 #include "mem/AllocatorProxy.h"
15 void *Mem::AllocatorProxy::alloc() {return xmalloc(64*1024);}
16 void Mem::AllocatorProxy::freeOne(void *address) {xfree(address);}
17 int Mem::AllocatorProxy::inUseCount() const {return 0;}
18 //static MemPoolMeter tmpMemPoolMeter;
19 //MemPoolMeter const &Mem::AllocatorProxy::getMeter() const STUB_RETVAL(tmpMemPoolMeter)
21 
22 #include "mem/forward.h"
23 void Mem::Init() STUB_NOP
24 void Mem::Report() STUB_NOP
25 void Mem::Stats(StoreEntry *) STUB_NOP
27 void Report(std::ostream &) STUB_NOP
28 void PoolReport(const MemPoolStats *, const MemPoolMeter *, std::ostream &) STUB_NOP
29 //const size_t squidSystemPageSize = 4096;
30 void memClean(void) STUB
31 void memInitModule(void) STUB
32 void memCleanModule(void) STUB
33 void memConfigure(void) STUB
34 
36 {
37  // let's waste plenty of memory. This should cover any possible need
38  return xmalloc(64*1024);
39 }
40 
41 void *memAllocString(size_t net_size, size_t * gross_size) {return memAllocBuf(net_size, gross_size);}
42 
43 void *memAllocRigid(size_t net_size)
44 {
45  return xmalloc(net_size);
46 }
47 
48 void *
49 memAllocBuf(size_t net_size, size_t * gross_size)
50 {
51  *gross_size=net_size;
52  return xcalloc(1, net_size);
53 }
54 
55 /* net_size is the new size, *gross size is the old gross size, to be changed to
56  * the new gross size as a side-effect.
57  */
58 void *
59 memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size)
60 {
61  void *rv=xrealloc(oldbuf,net_size);
62 // if (net_size > *gross_size)
63 // memset(rv+net_size,0,net_size-*gross_size);
64  *gross_size=net_size;
65  return rv;
66 }
67 
68 void memFree(void *p, int) {xfree(p);}
69 void memFreeString(size_t, void *buf) {xfree(buf);}
70 void memFreeRigid(void *buf, size_t) {xfree(buf);}
71 void memFreeBuf(size_t, void *buf) {xfree(buf);}
72 static void cxx_xfree(void * ptr) {xfree(ptr);}
73 FREE *memFreeBufFunc(size_t) {return cxx_xfree;}
75 void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP
77 
78 #include "mem/Pool.h"
80 void MemPoolMeter::flush() STUB
82 MemPools &MemPools::GetInstance() {return tmpMemPools;}
84  pools(nullptr),
85  mem_idle_limit(0),
86  poolCount(0),
87  defaultIsChunked(false)
88 {}
90 MemImplementingAllocator * MemPools::create(const char *, size_t) STUB_RETVAL(nullptr);
91 void MemPools::setIdleLimit(ssize_t) STUB
92 ssize_t MemPools::idleLimit() const STUB_RETVAL(0)
93 void MemPools::clean(time_t) STUB
94 void MemPools::setDefaultPoolChunking(bool const &) STUB
95 
96 //MemAllocator::MemAllocator(char const *aLabel);
97 char const *MemAllocator::objectType() const STUB_RETVAL(nullptr)
98 int MemAllocator::inUseCount() STUB_RETVAL(0)
99 size_t MemAllocator::RoundedSize(size_t minSize) STUB_RETVAL(minSize)
100 
101 //MemImplementingAllocator::MemImplementingAllocator(char const *, size_t) STUB_NOP
102 //MemImplementingAllocator::~MemImplementingAllocator();
105 void MemImplementingAllocator::flushMetersFull() STUB
106 void MemImplementingAllocator::flushMeters() STUB
107 void *MemImplementingAllocator::alloc() STUB_RETVAL(nullptr)
108 void MemImplementingAllocator::freeOne(void *) STUB
109 
115 
MemImplementingAllocator * memPoolIterateNext(MemPoolIterator *iter)
Definition: Pool.cc:55
void Stats(StoreEntry *)
Definition: old_api.cc:166
void memCleanModule(void)
Definition: stub_libmem.cc:32
#define xcalloc
Definition: membanger.c:57
void Report()
Definition: old_api.cc:479
int inUseCount() const
void CleanIdlePools(void *unused)
Definition: old_api.cc:400
void memConfigure(void)
Definition: old_api.cc:407
void flushMeters()
Definition: Pool.cc:174
char * p
Definition: membanger.c:43
void FREE(void *)
Definition: forward.h:36
void * memReallocBuf(void *buf, size_t net_size, size_t *gross_size)
Definition: old_api.cc:360
void * memAllocBuf(size_t net_size, size_t *gross_size)
Definition: old_api.cc:345
Definition: Pool.h:116
void * memAllocRigid(size_t net_size)
Definition: old_api.cc:249
#define STUB_RETVAL(x)
Definition: STUB.h:41
void * memAllocate(mem_type)
Allocate one element from the typed pool.
Definition: old_api.cc:214
void Init()
Definition: old_api.cc:437
void * xrealloc(void *s, size_t sz)
Definition: xalloc.cc:137
#define STUB
macro to stub a void function.
Definition: STUB.h:33
void memFreeRigid(void *, size_t net_size)
Definition: old_api.cc:291
int memPoolGetGlobalStats(MemPoolGlobalStats *stats)
Definition: Pool.cc:250
void const char * buf
Definition: stub_helper.cc:16
void * memAllocString(size_t net_size, size_t *gross_size)
Definition: old_api.cc:230
static MemPools tmpMemPools
Definition: stub_libmem.cc:81
void memFreeBuf(size_t size, void *)
Definition: old_api.cc:384
static void cxx_xfree(void *ptr)
Definition: stub_libmem.cc:72
int memInUse(mem_type)
Definition: old_api.cc:527
int memPoolsTotalAllocated(void)
Definition: Pool.cc:299
#define xmalloc
void freeOne(void *)
Free a element allocated by Mem::AllocatorProxy::alloc()
void memDataInit(mem_type, const char *, size_t, int, bool doZero=true)
Definition: old_api.cc:201
void memFree(void *, int type)
Free a element allocated by memAllocate()
Definition: old_api.cc:222
MemPoolMeter()
Definition: Pool.cc:165
void memFreeString(size_t size, void *)
Definition: old_api.cc:277
void memInitModule(void)
Definition: stub_libmem.cc:31
mem_type
Types of memory pool which do not yet use MEMPROXY_CLASS() API.
Definition: forward.h:39
void memPoolIterateDone(MemPoolIterator **iter)
Definition: Pool.cc:47
MemPools()
Definition: Pool.cc:84
void memCheckInit(void)
Definition: old_api.cc:498
#define STUB_NOP
Definition: STUB.h:37
void memClean(void)
Main cleanup handler.
Definition: old_api.cc:512
#define xfree
MemPoolIterator * memPoolIterate(void)
Definition: Pool.cc:40
int getStats(MemPoolStats *stats)
FREE * memFreeBufFunc(size_t size)
Definition: old_api.cc:577
#define STUB_RETSTATREF(x)
Definition: STUB.h:54
void * alloc()
Allocate one element from the pool.
#define false
Definition: GnuRegex.c:233
void PoolReport(const MemPoolStats *mp_st, const MemPoolMeter *AllMeter, std::ostream &)
Definition: old_api.cc:609

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors