There are no logic changes in this patch.
* Some code is using the 'old' or internal pool allocation APIs
directly. These have been marked with XXX for future logic
changes to update.
* The memory pools API and MEMPROXY_CLASS() definition are now
available through the mem/forward.h header file.
* Mem:: namespace has been added for library contents.
* MemAllocatorProxy class has been moved into Mem:: namespace
and extracted from mem.cc but should only be used via the
MEMPROXY_CLASS() macro.
* Extended the memory STUB file to define all mem/forward.h
symbols and a few others needed currently by code using the
older deprecated memory APIs.
Also, some time API functions exported by util.h instead of
SquidTime.h have been marked as needing work.
src/ident/Makefile
src/ip/Makefile
src/log/Makefile
+ src/mem/Makefile
src/ipc/Makefile
src/ssl/Makefile
src/mgr/Makefile
hash.cc
libmiscutil_la_SOURCES = \
- MemPool.cc \
- MemPoolChunked.cc \
- MemPoolMalloc.cc \
getfullhostname.c \
heap.c \
iso3307.c \
#include "squid.h"
#include "md5.h"
-#include "Mem.h"
#include "StatCounters.h"
#include "Store.h"
#include "store_key_md5.h"
#if USE_CACHE_DIGESTS
#include "CacheDigest.h"
+#include "util.h"
/* local types */
#ifndef SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
#define SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
+#include "fatal.h"
#include "fde.h"
#include "globals.h"
/* DEBUG: section 79 Squid-side Disk I/O functions. */
#include "squid.h"
-
#include "DiskThreadsDiskFile.h"
#include "DiskThreadsIOStrategy.h"
#include "fde.h"
#include "StatCounters.h"
#include "Store.h"
+/* squidaio_ctrl_t uses explicit alloc()/freeOne().
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
void
DiskThreadsIOStrategy::init(void)
{
#include "SquidTime.h"
#include "Store.h"
+/*
+ * struct stat and squidaio_xstrdup use explicit pool alloc()/freeOne().
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
#include <cerrno>
#include <csignal>
#include <sys/stat.h>
#include "Generic.h"
#include "Store.h"
+/*
+ * squidaio_ctrl_t uses explicit alloc()/freeOne() allocators
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
AIOCounts squidaio_counts;
typedef struct squidaio_unlinkq_t {
#include "base/AsyncCallQueue.h"
#include "Debug.h"
#include "EventLoop.h"
+#include "fatal.h"
#include "SquidTime.h"
EventLoop *EventLoop::Running = NULL;
#include "StatHist.h"
#include "Store.h"
#include "StrList.h"
+#include "util.h"
#include <map>
#define SQUID_HTTPHDRCC_H
#include "enums.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "SquidString.h"
class Packer;
#include "enums.h"
#include "HttpHdrContRange.h"
#include "HttpHeaderTools.h"
-#include "Mem.h"
/*
* Currently only byte ranges are supported
#include "HttpHeaderTools.h"
#include "Store.h"
#include "StrList.h"
+#include "util.h"
#include <map>
#include "defines.h"
#include "dlink.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "SquidString.h"
#include "typedefs.h"
#include "Store.h"
#include "StrList.h"
#include "TimeOrTag.h"
+#include "util.h"
#include <algorithm>
#include "http/RegisteredHeaders.h"
/* because we pass a spec by value */
#include "HttpHeaderMask.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "SquidString.h"
#include <vector>
#ifndef SQUID_HTTPHEADERRANGE_H
#define SQUID_HTTPHEADERRANGE_H
-#include "MemPool.h"
+#include "mem/forward.h"
#include "Packer.h"
#include "Range.h"
#include "SquidString.h"
LoadableModules.h \
LoadableModules.cc
-SUBDIRS = base anyp helper ftp parser comm eui acl format clients servers fs repl
-DIST_SUBDIRS = base anyp helper ftp parser comm eui acl format clients servers fs repl
+SUBDIRS = mem base anyp helper ftp parser comm eui acl format clients servers fs repl
+DIST_SUBDIRS = mem base anyp helper ftp parser comm eui acl format clients servers fs repl
if ENABLE_AUTH
SUBDIRS += auth
main.cc \
MasterXaction.cc \
MasterXaction.h \
- Mem.h \
- mem.cc \
mem_node.cc \
mem_node.h \
- Mem.h \
MemBuf.cc \
MemObject.cc \
MemObject.h \
$(ADAPTATION_LIBS) \
$(ESI_LIBS) \
$(SNMP_LIBS) \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
## SwapDir wants ConfigOption
## tools.cc wants ip/libip.la
## client_side.cc wants ip/libip.la
-## mem.cc wants ClientInfo.h
## libbase.la wants cbdata.*
## libbase.la wants MemBuf.*
ufsdump_SOURCES = \
debug.cc \
int.h \
int.cc \
- Mem.h \
- mem.cc \
+ mem/forward.h \
MemBuf.cc \
MemBuf.h \
Parsing.h \
HttpReply.h \
MasterXaction.cc \
MasterXaction.h \
- Mem.h \
- tests/stub_mem.cc \
RegexList.h \
RegexList.cc \
MemBuf.cc \
ip/libip.la \
base/libbase.la \
ipc/libipc.la \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
tests/stub_time.cc \
url.cc \
URL.h \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
MemBuf.cc \
wordlist.h \
wordlist.cc
RequestFlags.h \
RequestFlags.cc \
HttpRequest.cc \
- Mem.h \
- tests/stub_mem.cc \
String.cc \
tests/testCacheManager.cc \
tests/testCacheManager.h \
ipc/libipc.la \
mgr/libmgr.la \
$(SNMP_LIBS) \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
MemBuf.cc \
MemObject.cc \
mem_node.cc \
- Mem.h \
- tests/stub_mem.cc \
Notes.h \
Notes.cc \
Packer.cc \
$(SSL_LIBS) \
ipc/libipc.la \
base/libbase.la \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
mem_node.cc \
MemBuf.cc \
MemObject.cc \
MasterXaction.h \
MemBuf.cc \
MemObject.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
mem_node.cc \
mime.h \
mime.cc \
StatCounters.cc \
StatHist.h \
StatHist.cc \
- Mem.h \
stmem.cc \
repl_modules.h \
store.cc \
MasterXaction.h \
MemBuf.cc \
MemObject.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
mem_node.cc \
mime.h \
mime.cc \
MemBuf.cc \
MemBuf.h \
tests/stub_MemObject.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
mime_header.cc \
mime_header.h \
String.cc \
RequestFlags.h \
RequestFlags.cc \
HttpRequest.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
String.cc \
tests/testHttpRequest.h \
tests/testHttpRequest.cc \
SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
- Mem.h \
- tests/stub_mem.cc \
mem_node.cc \
MemBuf.cc \
MemObject.cc \
mgr/libmgr.la \
ipc/libipc.la \
anyp/libanyp.la \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
## libsquid pulls in SquidConfig and children. stub them.
tests_testString_SOURCES = \
ClientInfo.h \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
MemBuf.cc \
String.cc \
$(SBUF_SOURCE) \
HttpHeaderTools.cc \
HttpHeader.h \
HttpHeader.cc \
- Mem.h \
- mem.cc \
ClientInfo.h \
MemBuf.cc \
HttpHdrContRange.cc \
anyp/libanyp.la \
base/libbase.la \
ip/libip.la \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
SquidList.cc \
MasterXaction.cc \
MasterXaction.h \
- Mem.h \
- mem.cc \
MemBuf.cc \
MemObject.cc \
mem_node.cc \
$(SSL_LIBS) \
ipc/libipc.la \
base/libbase.la \
+ mem/libmem.la \
$(top_builddir)/lib/libmisccontainers.la \
$(top_builddir)/lib/libmiscencoding.la \
$(top_builddir)/lib/libmiscutil.la \
MasterXaction.h \
multicast.h \
multicast.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
mem_node.cc \
MemBuf.cc \
MemObject.cc \
tests/stub_SBufDetailedStats.cc \
SBufStream.h \
tests/stub_time.cc \
- mem.cc \
tests/stub_debug.cc \
tests/stub_fatal.cc \
tests/stub_HelperChildConfig.cc \
+ tests/stub_libmem.cc \
tests/stub_cache_cf.cc \
tests/stub_cache_manager.cc \
tests/stub_store.cc \
tests/stub_SBufDetailedStats.cc \
SBufStream.h \
tests/stub_time.cc \
- mem.cc \
tests/stub_MemObject.cc \
tests/stub_cbdata.cc \
tests/stub_comm.cc \
tests/stub_fatal.cc \
tests/stub_fd.cc \
tests/stub_HelperChildConfig.cc \
+ tests/stub_libmem.cc \
tests/stub_cache_cf.cc \
tests/stub_cache_manager.cc \
tests/stub_store.cc \
tests_testConfigParser_SOURCES = \
ClientInfo.h \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
tests/stub_MemBuf.cc \
tests/stub_time.cc \
$(SBUF_SOURCE) \
tests/stub_debug.cc \
tests/stub_DelayId.cc \
tests/stub_HelperChildConfig.cc \
- Mem.h \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
tests/stub_MemObject.cc \
mime.h \
tests/stub_mime.cc \
#include "squid.h"
#include "base/TextException.h"
#include "Debug.h"
-#include "Mem.h"
#include "MemBlob.h"
#include "SBufDetailedStats.h"
#include "base/InstanceId.h"
#include "base/RefCount.h"
-#include "MemPool.h"
+#include "mem/forward.h"
/// Various MemBlob class-wide statistics.
class MemBlobStats
*/
#include "squid.h"
-#include "Mem.h"
+#include "mem/forward.h"
#include "MemBuf.h"
#include "profiler/Profiler.h"
#include "acl/forward.h"
#include "base/RefCount.h"
#include "format/Format.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "SquidString.h"
#include "typedefs.h"
/* DEBUG: none Linked list functions (deprecated) */
#include "squid.h"
-#include "Mem.h"
+#include "mem/forward.h"
#include "SquidList.h"
#include "typedefs.h"
#ifndef SQUID_STOREMETAMD5_H
#define SQUID_STOREMETAMD5_H
-#include "MemPool.h"
#include "StoreMeta.h"
/* for STORE_META_KEY_MD5 */
#include "enums.h"
#ifndef SQUID_STOREMETAOBJSIZE_H
#define SQUID_STOREMETAOBJSIZE_H
-#include "MemPool.h"
#include "StoreMeta.h"
class StoreMetaObjSize : public StoreMeta
#ifndef SQUID_STOREMETASTD_H
#define SQUID_STOREMETASTD_H
-#include "MemPool.h"
#include "StoreMeta.h"
class StoreMetaSTD : public StoreMeta
#ifndef SQUID_STOREMETASTDLFS_H
#define SQUID_STOREMETASTDLFS_H
-#include "MemPool.h"
#include "StoreMeta.h"
class StoreMetaSTDLFS : public StoreMeta
#ifndef SQUID_STOREMETAURL_H
#define SQUID_STOREMETAURL_H
-#include "MemPool.h"
#include "StoreMeta.h"
class StoreMetaURL : public StoreMeta
#ifndef SQUID_STOREMETAVARY_H
#define SQUID_STOREMETAVARY_H
-#include "MemPool.h"
#include "StoreMeta.h"
class StoreMetaVary : public StoreMeta
*/
#include "md5.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "typedefs.h"
/// maintains a 24-bit checksum over integer fields
#include "squid.h"
#include "base/TextException.h"
-#include "Mem.h"
#include "mgr/Registration.h"
#include "profiler/Profiler.h"
#include "Store.h"
#define SQUID_SRC_URL_H
#include "anyp/UriScheme.h"
-#include "MemPool.h"
#include "SBuf.h"
/**
#include "ConfigParser.h"
#include "Debug.h"
#include "dlink.h"
+#include "fatal.h"
#include "globals.h"
#include "profiler/Profiler.h"
#include "SquidConfig.h"
#include "cbdata.h"
#include "defines.h"
#include "dlink.h"
-#include "MemPool.h"
#include "SBufList.h"
#include <ostream>
#include "cache_cf.h"
#include "Debug.h"
#include "src/URL.h"
+#include "util.h"
template<class T>
inline void
#include "errorpage.h"
#include "globals.h"
#include "HttpRequest.h"
-#include "Mem.h"
#include <set>
#include <algorithm>
#include "acl/Checklist.h"
#include "acl/HierCodeData.h"
#include "cache_cf.h"
+#include "fatal.h"
#include "hier_code.h"
ACLHierCodeData::ACLHierCodeData()
#include "acl/Data.h"
#include "HttpHeader.h"
-#include "MemPool.h"
#include "SquidString.h"
class ACLHTTPHeaderData : public ACLData<HttpHeader*>
#include "acl/IntRange.h"
#include "cache_cf.h"
#include "Debug.h"
+#include "fatal.h"
#include "Parsing.h"
void
#define SQUID_ACLNOTEDATA_H
#include "acl/Data.h"
-#include "MemPool.h"
#include "SquidString.h"
class HttpRequest;
#include "acl/RegexData.h"
#include "ConfigParser.h"
#include "Debug.h"
-#include "Mem.h"
#include "RegexList.h"
#include "wordlist.h"
#define SQUID_ACLREGEXDATA_H
#include "acl/Data.h"
-#include "MemPool.h"
class RegexList;
#ifndef SQUID_ACLSTRATEGISED_H
#define SQUID_ACLSTRATEGISED_H
+
#include "acl/Acl.h"
#include "acl/Data.h"
#include "acl/FilledChecklist.h"
#include "acl/Strategy.h"
template <class M>
-
class ACLStrategised : public ACL
{
+ MEMPROXY_CLASS(ACLStrategised);
public:
typedef M MatchType;
- void *operator new(size_t);
- void operator delete(void *);
~ACLStrategised();
ACLStrategised(ACLData<MatchType> *, ACLStrategy<MatchType> *, char const *, const ACLFlag flags[] = ACLFlags::NoFlags);
virtual ACL *clone()const;
private:
- static MemAllocator *Pool;
ACLData<MatchType> *data;
char const *type_;
ACLStrategy<MatchType> *matcher;
/* implementation follows */
-template <class MatchType>
-MemAllocator *ACLStrategised<MatchType>::Pool = NULL;
-
-template <class MatchType>
-void *
-ACLStrategised<MatchType>::operator new (size_t byteCount)
-{
- /* derived classes with different sizes must implement their own new */
- assert (byteCount == sizeof (ACLStrategised<MatchType>));
-
- if (!Pool)
- Pool = memPoolCreate("ACLStrategised", sizeof (ACLStrategised<MatchType>));
-
- return Pool->alloc();
-}
-
-template <class MatchType>
-void
-ACLStrategised<MatchType>::operator delete (void *address)
-{
- Pool->freeOne(address);
-}
-
template <class MatchType>
ACLStrategised<MatchType>::~ACLStrategised()
{
#include "acl/UserData.h"
#include "ConfigParser.h"
#include "Debug.h"
+#include "util.h"
template<class T>
inline void
#include "HttpRequest.h"
#include "icap_log.h"
#include "ipcache.h"
-#include "Mem.h"
#include "pconn.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "auth/AclProxyAuth.h"
#include "auth/UserRequest.h"
#include "client_side.h"
+#include "fatal.h"
#include "HttpRequest.h"
/**
#include "auth/Config.h"
#include "auth/User.h"
#include "hash.h"
-#include "MemPool.h"
/**
\ingroup AuthAPI
#include "auth/UserRequest.h"
#include "client_side.h"
#include "comm/Connection.h"
+#include "fatal.h"
#include "format/Format.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "rfc1738.h"
#include "SquidTime.h"
#include "Store.h"
+#include "util.h"
#include "uudecode.h"
#include "wordlist.h"
#define _SQUID_SRC_AUTH_BASIC_USERREQUEST_H
#include "auth/UserRequest.h"
-#include "MemPool.h"
class ConnStateData;
class HttpRequest;
#include "StrList.h"
#include "wordlist.h"
-/* Digest Scheme */
+/* digest_nonce_h still uses explicit alloc()/freeOne() MemPool calls.
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
static AUTHSSTATS authenticateDigestStats;
#define _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H
#include "auth/UserRequest.h"
-#include "MemPool.h"
class ConnStateData;
class HttpReply;
#include "auth/State.h"
#include "auth/User.h"
#include "client_side.h"
+#include "fatal.h"
#include "format/Format.h"
#include "globals.h"
#include "helper.h"
#include "auth/UserRequest.h"
#include "helper/forward.h"
-#include "MemPool.h"
class ConnStateData;
class HttpReply;
#include "auth/State.h"
#include "cbdata.h"
#include "client_side.h"
+#include "fatal.h"
#include "format/Format.h"
#include "globals.h"
#include "helper.h"
#include "auth/UserRequest.h"
#include "helper/forward.h"
-#include "MemPool.h"
class ConnStateData;
class HttpReply;
#include "ipc/Kids.h"
#include "log/Config.h"
#include "log/CustomLog.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "mgr/ActionPasswordList.h"
#include "mgr/Registration.h"
#include "StoreFileSystem.h"
#include "SwapDir.h"
#include "tools.h"
+#include "util.h"
#include "wordlist.h"
/* wccp2 has its own conditional definitions */
#include "wccp2.h"
#include "Generic.h"
#include "mgr/Registration.h"
#include "Store.h"
+#include "mem/Pool.h"
#include <climits>
#if USE_CBDATA_DEBUG
#include "fqdncache.h"
#include "ip/Address.h"
#include "log/access_log.h"
-#include "Mem.h"
#include "mgr/Registration.h"
#include "SquidConfig.h"
#include "SquidMath.h"
#include "ipc/FdNotes.h"
#include "ipc/StartListening.h"
#include "log/access_log.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "mime_header.h"
#include "ssl/crtd_message.h"
#endif
+// for tvSubUsec() which should be in SquidTime.h
+#include "util.h"
+
#include <climits>
#include <cmath>
#include <limits>
#include "fd.h"
#include "ftp/Parsing.h"
#include "ip/tools.h"
-#include "Mem.h"
#include "SquidConfig.h"
#include "SquidString.h"
#include "StatCounters.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "ip/tools.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "mime.h"
#include "rfc1738.h"
#include "Store.h"
#include "tools.h"
#include "URL.h"
+#include "util.h"
#include "wordlist.h"
#if USE_DELAY_POOLS
#include "defines.h"
#include "hier_code.h"
#include "ip/Address.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "typedefs.h"
#if USE_SQUID_EUI
#include "eui/Eui48.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "profiler/Profiler.h"
#include "StatCounters.h"
#include "squid.h"
#include "dlink.h"
-/* dlink are Mem-pooled */
-#include "MemPool.h"
+/* dlink_node use explicit alloc()/freeOne()
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
dlink_list ClientActiveRequests;
#include "fd.h"
#include "fde.h"
#include "ip/tools.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "mgr/Registration.h"
#include "rfc3596.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "ip/Address.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "profiler/Profiler.h"
#include "SquidConfig.h"
#include "esi/Element.h"
#include "esi/ElementList.h"
-#include "MemPool.h"
+#include "mem/forward.h"
/* esiSequence */
#include "squid.h"
#include "esi/VarState.h"
+#include "fatal.h"
#include "HttpReply.h"
-#include "Mem.h"
CBDATA_TYPE (ESIVarState);
FREE ESIVarStateFree;
#define SQUID_EVENT_H
#include "AsyncEngine.h"
-#include "MemPool.h"
+#include "mem/forward.h"
class StoreEntry;
#include "squid.h"
#include "comm/Loops.h"
#include "Debug.h"
+#include "fatal.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
#include "DnsLookupDetails.h"
#include "event.h"
#include "helper.h"
-#include "Mem.h"
#include "mgr/Registration.h"
#include "SquidConfig.h"
#include "SquidDns.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
+#include "util.h"
#include "wordlist.h"
#if SQUID_SNMP
#include "fs/rock/RockIoState.h"
#include "fs/rock/RockSwapDir.h"
#include "globals.h"
-#include "Mem.h"
#include "MemObject.h"
#include "Parsing.h"
#include "Transients.h"
#include "html_quote.h"
#include "HttpReply.h"
#include "HttpRequest.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "mime.h"
#include "rfc1738.h"
#include "helper.h"
#include "helper/Reply.h"
#include "helper/Request.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "SquidIpc.h"
#include "SquidMath.h"
#include "Store.h"
#include "wordlist.h"
+// helper_stateful_server::data uses explicit alloc()/freeOne() */
+#include "mem/Pool.h"
+
#define HELPER_MAX_ARGS 64
/** Initial Squid input buffer size. Helper responses may exceed this, and
#include "tools.h"
#include "URL.h"
+/** htcpDetail uses explicit alloc()/freeOne()
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
typedef struct _Countstr Countstr;
typedef struct _htcpHeader htcpHeader;
#include "StrList.h"
#include "tools.h"
#include "URL.h"
+#include "util.h"
#if USE_AUTH
#include "auth/UserRequest.h"
#include "internal.h"
#include "ip/Address.h"
#include "log/File.h"
-#include "Mem.h"
#include "MemObject.h"
#include "mgr/Registration.h"
#include "mime_header.h"
#include "tools.h"
#include "wordlist.h"
+// for tvSubUsec() which should be in SquidTime.h
+#include "util.h"
+
#include <cerrno>
static void icpIncomingConnectionOpened(const Comm::ConnectionPointer &conn, int errNo);
#include "Store.h"
#include "tools.h"
#include "URL.h"
+#include "util.h"
#include "wordlist.h"
/* called when we "miss" on an internal object;
#include "CommCalls.h"
#include "ipc/Port.h"
#include "tools.h"
+#include "util.h"
static const char channelPathPfx[] = DEFAULT_STATEDIR "/";
static const char coordinatorAddrLabel[] = "-coordinator";
#include "ip/Address.h"
#include "ip/tools.h"
#include "ipcache.h"
-#include "Mem.h"
#include "mgr/Registration.h"
#include "rfc3596.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "StatCounters.h"
#include "Store.h"
+#include "util.h"
#include "wordlist.h"
#if SQUID_SNMP
/* DEBUG: section 50 Log file handling */
#include "squid.h"
+#include "fatal.h"
#include "fde.h"
#include "log/File.h"
#include "log/ModDaemon.h"
#include "squid.h"
#include "cbdata.h"
#include "comm/Loops.h"
+#include "fatal.h"
#include "fde.h"
#include "globals.h"
#include "log/Config.h"
#include "squid.h"
#include "disk.h"
+#include "fatal.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
#include "comm.h"
#include "comm/Connection.h"
#include "disk.h"
+#include "fatal.h"
#include "fd.h"
#include "log/File.h"
#include "log/ModUdp.h"
#include "comm/ConnOpener.h"
#include "comm/Loops.h"
#include "comm/Write.h"
+#include "fatal.h"
#include "fde.h"
#include "globals.h" // for shutting_down
#include "log/CustomLog.h"
#include "ipc/Kids.h"
#include "ipc/Strand.h"
#include "ipcache.h"
-#include "Mem.h"
-#include "MemPool.h"
#include "mime.h"
#include "neighbors.h"
#include "parser/Tokenizer.h"
--- /dev/null
+#include "squid.h"
+#include "mem/AllocatorProxy.h"
+#include "mem/Pool.h"
+
+void *
+Mem::AllocatorProxy::alloc()
+{
+ return getAllocator()->alloc();
+}
+
+void
+Mem::AllocatorProxy::freeOne(void *address)
+{
+ getAllocator()->freeOne(address);
+ /* TODO: check for empty, and if so, if the default type has altered,
+ * switch
+ */
+}
+
+MemAllocator *
+Mem::AllocatorProxy::getAllocator() const
+{
+ if (!theAllocator)
+ theAllocator = MemPools::GetInstance().create(objectType(), size);
+ return theAllocator;
+}
+
+int
+Mem::AllocatorProxy::inUseCount() const
+{
+ if (!theAllocator)
+ return 0;
+ else
+ return memPoolInUseCount(theAllocator);
+}
+
+MemPoolMeter const &
+Mem::AllocatorProxy::getMeter() const
+{
+ return getAllocator()->getMeter();
+}
+
+int
+Mem::AllocatorProxy::getStats(MemPoolStats * stats)
+{
+ return getAllocator()->getStats(stats);
+}
--- /dev/null
+/*
+ * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#ifndef _SQUID_SRC_MEM_ALLOCATORPROXY_H
+#define _SQUID_SRC_MEM_ALLOCATORPROXY_H
+
+class MemAllocator;
+class MemPoolStats;
+class MemPoolMeter;
+
+/**
+ * \hideinitializer
+ *
+ * Pool and account the memory used for the CLASS object.
+ * This macro is intended for use within the declaration of a class.
+ */
+#define MEMPROXY_CLASS(CLASS) \
+ private: \
+ static inline Mem::AllocatorProxy &Pool() { \
+ static Mem::AllocatorProxy thePool(#CLASS, sizeof(CLASS)); \
+ return thePool; \
+ } \
+ public: \
+ void *operator new(size_t byteCount) { \
+ /* derived classes with different sizes must implement their own new */ \
+ assert(byteCount == sizeof(CLASS)); \
+ return Pool().alloc(); \
+ } \
+ void operator delete(void *address) {Pool().freeOne(address);} \
+ private:
+
+namespace Mem
+{
+
+/**
+ * Support late binding of pool type for allocator agnostic classes
+ */
+class AllocatorProxy
+{
+public:
+ AllocatorProxy(char const *aLabel, size_t const &aSize):
+ label(aLabel),
+ size(aSize),
+ theAllocator(NULL)
+ {}
+
+ /// Allocate one element from the pool
+ void *alloc();
+
+ /// Free a element allocated by Mem::AllocatorProxy::alloc()
+ void freeOne(void *);
+
+ int inUseCount() const;
+ size_t objectSize() const {return size;}
+ char const * objectType() const {return label;}
+
+ MemPoolMeter const &getMeter() const;
+
+ /**
+ * \param stats Object to be filled with statistical data about pool.
+ * \retval Number of objects in use, ie. allocated.
+ */
+ int getStats(MemPoolStats * stats);
+
+private:
+ MemAllocator *getAllocator() const;
+
+ const char *label;
+ size_t size;
+ mutable MemAllocator *theAllocator;
+};
+
+} // namespace Mem
+
+#endif /* _SQUID_SRC_MEM_ALLOCATORPROXY_H */
--- /dev/null
+## Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+##
+## Squid software is distributed under GPLv2+ license and includes
+## contributions from numerous individuals and organizations.
+## Please see the COPYING and CONTRIBUTORS files for details.
+##
+
+include $(top_srcdir)/src/Common.am
+include $(top_srcdir)/src/TestHeaders.am
+
+noinst_LTLIBRARIES = libmem.la
+
+libmem_la_SOURCES = \
+ AllocatorProxy.cc \
+ AllocatorProxy.h \
+ forward.h \
+ old_api.cc \
+ Pool.cc \
+ Pool.h \
+ PoolChunked.cc \
+ PoolChunked.h \
+ PoolMalloc.cc \
+ PoolMalloc.h
*/
#include "squid.h"
+#include "mem/PoolChunked.h"
+#include "mem/PoolMalloc.h"
#include <cassert>
-
-#include "MemPool.h"
-#include "MemPoolChunked.h"
-#include "MemPoolMalloc.h"
+#include <cstring>
#define FLUSH_LIMIT 1000 /* Flush memPool counters to memMeters after flush limit calls */
-#include <cstring>
-
-/*
- * XXX This is a boundary violation between lib and src.. would be good
- * if it could be solved otherwise, but left for now.
- */
extern time_t squid_curtime;
-/* local data */
static MemPoolMeter TheMeter;
static MemPoolIterator Iterator;
-
static int Pool_id_counter = 0;
MemPools &
return stats.TheMeter->alloc.level;
}
-void *
-MemAllocatorProxy::alloc()
-{
- return getAllocator()->alloc();
-}
-
-void
-MemAllocatorProxy::freeOne(void *address)
-{
- getAllocator()->freeOne(address);
- /* TODO: check for empty, and if so, if the default type has altered,
- * switch
- */
-}
-
-MemAllocator *
-MemAllocatorProxy::getAllocator() const
-{
- if (!theAllocator)
- theAllocator = MemPools::GetInstance().create(objectType(), size);
- return theAllocator;
-}
-
-int
-MemAllocatorProxy::inUseCount() const
-{
- if (!theAllocator)
- return 0;
- else
- return memPoolInUseCount(theAllocator);
-}
-
-size_t
-MemAllocatorProxy::objectSize() const
-{
- return size;
-}
-
-char const *
-MemAllocatorProxy::objectType() const
-{
- return label;
-}
-
-MemPoolMeter const &
-MemAllocatorProxy::getMeter() const
-{
- return getAllocator()->getMeter();
-}
-
-int
-MemAllocatorProxy::getStats(MemPoolStats * stats)
-{
- return getAllocator()->getStats(stats);
-}
-
MemImplementingAllocator::MemImplementingAllocator(char const *aLabel, size_t aSize) : MemAllocator(aLabel),
next(NULL),
alloc_calls(0),
* might be the way to go.
*/
-#include "util.h"
-
#include "memMeter.h"
#include "splay.h"
+#include "util.h"
#if HAVE_GNUMALLOC_H
#include <gnumalloc.h>
#elif HAVE_MALLOC_H
#include <malloc.h>
#endif
-
#if HAVE_MEMORY_H
#include <memory.h>
#endif
/// \ingroup MemPoolsAPI
#define MEM_PAGE_SIZE 4096
/// \ingroup MemPoolsAPI
-#define MEM_CHUNK_SIZE 4096 * 4
-/// \ingroup MemPoolsAPI
-#define MEM_CHUNK_MAX_SIZE 256 * 1024 /* 2MB */
-/// \ingroup MemPoolsAPI
#define MEM_MIN_FREE 32
/// \ingroup MemPoolsAPI
#define MEM_MAX_FREE 65535 /* unsigned short is max number of items per chunk */
const char *label;
};
-/**
- \ingroup MemPoolsAPI
- * Support late binding of pool type for allocator agnostic classes
- */
-class MemAllocatorProxy
-{
-public:
- inline MemAllocatorProxy(char const *aLabel, size_t const &);
-
- /**
- * Allocate one element from the pool
- */
- void *alloc();
-
- /**
- * Free a element allocated by MemAllocatorProxy::alloc()
- */
- void freeOne(void *);
-
- int inUseCount() const;
- size_t objectSize() const;
- MemPoolMeter const &getMeter() const;
-
- /**
- \param stats Object to be filled with statistical data about pool.
- \retval Number of objects in use, ie. allocated.
- */
- int getStats(MemPoolStats * stats);
-
- char const * objectType() const;
-private:
- MemAllocator *getAllocator() const;
- const char *label;
- size_t size;
- mutable MemAllocator *theAllocator;
-};
-
-/* help for classes */
-
-/**
- * \ingroup MemPoolsAPI
- * \hideinitializer
- *
- * Pool and account the memory used for the CLASS object.
- * This macro is intended for use within the declaration of a class.
- */
-#define MEMPROXY_CLASS(CLASS) \
- private: \
- static inline MemAllocatorProxy &Pool() { \
- static MemAllocatorProxy thePool(#CLASS, sizeof(CLASS)); \
- return thePool; \
- } \
- public: \
- void *operator new(size_t byteCount) { \
- /* derived classes with different sizes must implement their own new */ \
- assert (byteCount == sizeof(CLASS)); \
- return Pool().alloc(); \
- } \
- void operator delete(void *address) {Pool().freeOne(address);} \
- private:
-
/// \ingroup MemPoolsAPI
class MemImplementingAllocator : public MemAllocator
{
/// \ingroup MemPoolsAPI
extern int memPoolsTotalAllocated(void);
-MemAllocatorProxy::MemAllocatorProxy(char const *aLabel, size_t const &aSize) : label (aLabel), size(aSize), theAllocator (NULL)
-{
-}
-
#endif /* _MEM_POOL_H_ */
*/
#include "squid.h"
+#include "mem/PoolChunked.h"
#include <cassert>
-
-#include "MemPoolChunked.h"
+#include <cstring>
#define MEM_MAX_MMAP_CHUNKS 2048
-#include <cstring>
-
/*
* Old way:
* xmalloc each item separately, upon free stack into idle pool array.
* Andres Kroonmaa.
*/
-/*
- * XXX This is a boundary violation between lib and src.. would be good
- * if it could be solved otherwise, but left for now.
- */
extern time_t squid_curtime;
/* local prototypes */
#ifndef _MEM_POOL_CHUNKED_H_
#define _MEM_POOL_CHUNKED_H_
-#include "MemPool.h"
+#include "mem/Pool.h"
-/// \ingroup MemPoolsAPI
-#define MEM_PAGE_SIZE 4096
-/// \ingroup MemPoolsAPI
-#define MEM_CHUNK_SIZE 4096 * 4
-/// \ingroup MemPoolsAPI
+#define MEM_CHUNK_SIZE 4 * 4096 /* 16KB ... 4 * VM_PAGE_SZ */
#define MEM_CHUNK_MAX_SIZE 256 * 1024 /* 2MB */
-/// \ingroup MemPoolsAPI
-#define MEM_MIN_FREE 32
-/// \ingroup MemPoolsAPI
-#define MEM_MAX_FREE 65535 /* unsigned short is max number of items per chunk */
class MemChunk;
*/
#include "squid.h"
-#include "MemPoolMalloc.h"
+#include "mem/PoolMalloc.h"
#include <cassert>
#include <cstring>
-/*
- * XXX This is a boundary violation between lib and src.. would be good
- * if it could be solved otherwise, but left for now.
- */
extern time_t squid_curtime;
void *
* might be the way to go.
*/
-#include "MemPool.h"
+#include "mem/Pool.h"
#include <stack>
/* DEBUG: section 13 High Level Memory Pool Management */
-#ifndef SQUID_MEM
-#define SQUID_MEM
+#ifndef _SQUID_SRC_MEM_FORWARD_H
+#define _SQUID_SRC_MEM_FORWARD_H
/* for mem_type */
#include "enums.h"
+#include "mem/AllocatorProxy.h"
/* for FREE */
#include "typedefs.h"
class MemPoolStats;
class MemPoolMeter;
-class Mem
+namespace Mem
{
-
-public:
- static void Init();
- static void Report();
- static void Stats(StoreEntry *);
- static void CleanIdlePools(void *unused);
- static void Report(std::ostream &);
- static void PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std::ostream &);
-
-protected:
- static void RegisterWithCacheManager(void);
+ void Init();
+ void Report();
+ void Stats(StoreEntry *);
+ void CleanIdlePools(void *unused);
+ void Report(std::ostream &);
+ void PoolReport(const MemPoolStats * mp_st, const MemPoolMeter * AllMeter, std::ostream &);
};
extern const size_t squidSystemPageSize;
int memInUse(mem_type);
void memDataInit(mem_type, const char *, size_t, int, bool doZero = true);
void memCheckInit(void);
-void memConfigure(void);
-#endif /* SQUID_MEM */
+#endif /* _SQUID_SRC_MEM_FORWARD_H */
#include "event.h"
#include "icmp/net_db.h"
#include "md5.h"
-#include "Mem.h"
+#include "mem/forward.h"
#include "MemBuf.h"
#include "memMeter.h"
+#include "mem/Pool.h"
#include "mgr/Registration.h"
#include "RegexList.h"
#include "SquidConfig.h"
}
MemIsInitialized = true;
- /** \par
- * finally register with the cache manager */
- RegisterWithCacheManager();
+
+ // finally register with the cache manager
+ Mgr::RegisterAction("mem", "Memory Utilization", Mem::Stats, 0, 1);
}
void
" MB");
}
-void
-Mem::RegisterWithCacheManager(void)
-{
- Mgr::RegisterAction("mem", "Memory Utilization", Mem::Stats, 0, 1);
-}
-
mem_type &operator++ (mem_type &aMem)
{
int tmp = (int)aMem;
/* DEBUG: section 19 Store Memory Primitives */
#include "squid.h"
+#include "mem/Pool.h"
#include "mem_node.h"
static ptrdiff_t makeMemNodeDataOffset();
#define SQUID_MEM_NODE_H
#include "defines.h"
-#include "MemPool.h"
+#include "mem/forward.h"
#include "Range.h"
#include "StoreIOBuffer.h"
#include "HttpReply.h"
#include "HttpRequest.h"
#include "internal.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "mime.h"
Tokenizer.h
nodist_testTokenizer_SOURCES = \
$(top_srcdir)/src/tests/testMain.cc \
- $(top_srcdir)/src/tests/stub_mem.cc \
+ $(top_srcdir)/src/tests/stub_libmem.cc \
$(top_srcdir)/src/tests/stub_debug.cc \
$(top_srcdir)/src/tests/stub_time.cc \
$(top_srcdir)/src/tests/stub_SBufDetailedStats.cc
#include "store_key_md5.h"
#include "StoreClient.h"
#include "tools.h"
+#include "util.h"
/* local types */
#include "ICP.h"
#include "ip/tools.h"
#include "ipcache.h"
-#include "Mem.h"
#include "neighbors.h"
#include "peer_sourcehash.h"
#include "peer_userhash.h"
#include "SquidTime.h"
#include "Store.h"
#include "URL.h"
+#include "util.h"
typedef enum {
rcHTTP,
#include "SquidTime.h"
#include "Store.h"
+/* because LruNode use explicit memory alloc()/freeOne() calls.
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
REMOVALPOLICYCREATE createRemovalPolicy_lru;
struct LruPolicyData {
#include "StatHist.h"
#include "Store.h"
#include "tools.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
/************************************************************************
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "comm/UdpOpenDialer.h"
+#include "fatal.h"
#include "ip/Address.h"
#include "ip/tools.h"
#include "snmp/Forwarder.h"
#include "squid.h"
#include "errorpage.h"
+#include "fatal.h"
#include "ssl/ErrorDetail.h"
#include <climits>
#include "fde.h"
#include "globals.h"
#include "ip/Address.h"
-#include "Mem.h"
#include "ssl/bio.h"
#if HAVE_OPENSSL_SSL_H
#include "ssl/cert_validate_message.h"
#include "ssl/ErrorDetail.h"
#include "ssl/support.h"
+#include "util.h"
void
Ssl::CertValidationMsg::composeRequest(CertValidationRequest const &vcert)
#include "acl/FilledChecklist.h"
#include "anyp/PortCfg.h"
+#include "fatal.h"
#include "fd.h"
#include "fde.h"
#include "globals.h"
#include "globals.h"
#include "HttpRequest.h"
#include "IoStats.h"
+#include "mem/Pool.h"
#include "mem_node.h"
#include "MemBuf.h"
#include "MemObject.h"
#include "store_digest.h"
#include "StoreClient.h"
#include "tools.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
#if USE_AUTH
#include "auth/UserRequest.h"
#endif
#include "DelayPools.h"
#endif
+/** StoreEntry uses explicit new/delete operators, which set pool chunk size to 2MB
+ * XXX: convert to MEMPROXY_CLASS() API
+ */
+#include "mem/Pool.h"
+
#include <climits>
#include <stack>
#include "SquidTime.h"
#include "Store.h"
#include "StoreSearch.h"
+#include "util.h"
#include <cmath>
#include "SwapDir.h"
#include "tools.h"
#include "Transients.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
#include <cerrno>
#include <climits>
#include "squid.h"
#include "HttpRequest.h"
#include "md5.h"
-#include "Mem.h"
#include "store_key_md5.h"
#include "URL.h"
#include "store_rebuild.h"
#include "StoreSearch.h"
#include "SwapDir.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
#include <cerrno>
#ifndef SQUID_TESTS_CAPTURINGSTORE_ENTRY_H
#define SQUID_TESTS_CAPTURINGSTORE_ENTRY_H
-#include "Mem.h"
#include "Store.h"
/* class that captures various call data for test analysis */
tests/stub_libsslsquid.cc \
tests/stub_main_cc.cc \
tests/stub_MemBuf.cc \
- tests/stub_mem.cc \
+ tests/stub_libmem.cc \
tests/stub_mem_node.cc \
tests/stub_MemObject.cc \
tests/stub_MemStore.cc \
--- /dev/null
+/*
+ * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+
+#define STUB_API "mem/libmem.la"
+#include "STUB.h"
+
+#include "mem/AllocatorProxy.h"
+void *Mem::AllocatorProxy::alloc() {return xmalloc(64*1024);}
+void Mem::AllocatorProxy::freeOne(void *address) {xfree(address);}
+int Mem::AllocatorProxy::inUseCount() const {return 0;}
+//static MemPoolMeter tmpMemPoolMeter;
+//MemPoolMeter const &Mem::AllocatorProxy::getMeter() const STUB_RETVAL(tmpMemPoolMeter)
+int Mem::AllocatorProxy::getStats(MemPoolStats * stats) STUB_RETVAL(0)
+
+#include "mem/forward.h"
+void Mem::Init() STUB_NOP
+void Mem::Report() STUB_NOP
+void Mem::Stats(StoreEntry *) STUB_NOP
+void CleanIdlePools(void *) STUB_NOP
+void Report(std::ostream &) STUB_NOP
+void PoolReport(const MemPoolStats *, const MemPoolMeter *, std::ostream &) STUB_NOP
+//const size_t squidSystemPageSize = 4096;
+void memClean(void) STUB
+void memInitModule(void) STUB
+void memCleanModule(void) STUB
+void memConfigure(void) STUB
+
+void * memAllocate(mem_type type)
+{
+ // let's waste plenty of memory. This should cover any possible need
+ return xmalloc(64*1024);
+}
+
+void *memAllocString(size_t net_size, size_t * gross_size) {return memAllocBuf(net_size, gross_size);}
+
+void *
+memAllocBuf(size_t net_size, size_t * gross_size)
+{
+ *gross_size=net_size;
+ return xcalloc(1, net_size);
+}
+
+/* net_size is the new size, *gross size is the old gross size, to be changed to
+ * the new gross size as a side-effect.
+ */
+void *
+memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size)
+{
+ void *rv=xrealloc(oldbuf,net_size);
+// if (net_size > *gross_size)
+// memset(rv+net_size,0,net_size-*gross_size);
+ *gross_size=net_size;
+ return rv;
+}
+
+void memFree(void *p, int) {xfree(p);}
+void memFreeString(size_t, void *buf) {xfree(buf);}
+void memFreeBuf(size_t, void *buf) {xfree(buf);}
+static void cxx_xfree(void * ptr) {xfree(ptr);}
+FREE *memFreeBufFunc(size_t) {return cxx_xfree;}
+int memInUse(mem_type) STUB_RETVAL(0)
+void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP
+void memCheckInit(void) STUB_NOP
+
+#include "mem/Pool.h"
+MemPoolMeter::MemPoolMeter() STUB_NOP
+void MemPoolMeter::flush() STUB
+static MemPools tmpMemPools;
+MemPools &MemPools::GetInstance() {return tmpMemPools;}
+MemPools::MemPools() STUB_NOP
+void MemPools::init() STUB_NOP
+void MemPools::flushMeters() STUB
+MemImplementingAllocator * MemPools::create(const char *label, size_t obj_size) STUB_RETVAL(NULL);
+void MemPools::setIdleLimit(ssize_t new_idle_limit) STUB
+ssize_t MemPools::idleLimit() const STUB_RETVAL(0)
+void MemPools::clean(time_t maxage) STUB
+void MemPools::setDefaultPoolChunking(bool const &) STUB
+
+//MemAllocator::MemAllocator(char const *aLabel);
+char const *MemAllocator::objectType() const STUB_RETVAL(NULL)
+int MemAllocator::inUseCount() STUB_RETVAL(0)
+size_t MemAllocator::RoundedSize(size_t minSize) STUB_RETVAL(minSize)
+
+//MemImplementingAllocator::MemImplementingAllocator(char const *aLabel, size_t aSize) STUB_NOP
+//MemImplementingAllocator::~MemImplementingAllocator();
+MemPoolMeter const &MemImplementingAllocator::getMeter() const STUB_RETSTATREF(MemPoolMeter)
+MemPoolMeter &MemImplementingAllocator::getMeter() STUB_RETSTATREF(MemPoolMeter)
+void MemImplementingAllocator::flushMetersFull() STUB
+void MemImplementingAllocator::flushMeters() STUB
+void *MemImplementingAllocator::alloc() STUB_RETVAL(NULL)
+void MemImplementingAllocator::freeOne(void *) STUB
+
+MemPoolIterator * memPoolIterate(void) STUB_RETVAL(NULL)
+MemImplementingAllocator * memPoolIterateNext(MemPoolIterator * iter) STUB_RETVAL(NULL)
+void memPoolIterateDone(MemPoolIterator ** iter) STUB
+int memPoolGetGlobalStats(MemPoolGlobalStats * stats) STUB_RETVAL(0)
+int memPoolInUseCount(MemAllocator *) STUB_RETVAL(0)
+int memPoolsTotalAllocated(void) STUB_RETVAL(0)
+++ /dev/null
-/*
- * Copyright (C) 1996-2014 The Squid Software Foundation and contributors
- *
- * Squid software is distributed under GPLv2+ license and includes
- * contributions from numerous individuals and organizations.
- * Please see the COPYING and CONTRIBUTORS files for details.
- */
-
-/*
- * stub file for mem.cc
- */
-
-#include "squid.h"
-
-#define STUB_API "stub_mem.cc"
-#include "Mem.h"
-#include "STUB.h"
-
-void
-memFreeString(size_t size, void *buf)
-{
- xfree(buf);
-}
-
-void *
-memAllocString(size_t net_size, size_t * gross_size)
-{
- *gross_size=net_size;
- return xmalloc(net_size);
-}
-
-void
-memFreeBuf(size_t size, void *buf)
-{
- xfree(buf);
-}
-
-void *
-memAllocBuf(size_t net_size, size_t * gross_size)
-{
- *gross_size=net_size;
- return xcalloc(1, net_size);
-}
-
-/* net_size is the new size, *gross size is the old gross size, to be changed to
- * the new gross size as a side-effect.
- */
-void *
-memReallocBuf(void *oldbuf, size_t net_size, size_t * gross_size)
-{
- void *rv=xrealloc(oldbuf,net_size);
-// if (net_size > *gross_size)
-// memset(rv+net_size,0,net_size-*gross_size);
- *gross_size=net_size;
- return rv;
-}
-
-static void
-cxx_xfree(void * ptr)
-{
- xfree(ptr);
-}
-
-FREE *
-memFreeBufFunc(size_t size)
-{
- return cxx_xfree;
-}
-
-void * memAllocate(mem_type type)
-{
- // let's waste plenty of memory. This should cover any possible need
- return xmalloc(64*1024);
-}
-void memFree(void *p, int type)
-{
- xfree(p);
-}
-void Mem::Init(void) STUB_NOP
-void memDataInit(mem_type, const char *, size_t, int, bool) STUB_NOP
-int memInUse(mem_type) STUB_RETVAL(0)
-void memConfigure(void) STUB_NOP
#include "auth/Scheme.h"
#include "auth/UserRequest.h"
#include "ConfigParser.h"
-#include "Mem.h"
#include "testAuth.h"
CPPUNIT_TEST_SUITE_REGISTRATION( testAuth );
#include "squid.h"
#include "CacheManager.h"
-#include "Mem.h"
#include "mgr/Action.h"
#include "Store.h"
#include "testCacheManager.h"
#include "squid.h"
#include "ConfigParser.h"
#include "event.h"
-#include "Mem.h"
#include "SquidString.h"
#include "testConfigParser.h"
#include "DiskIO/DiskIOModule.h"
#include "HttpHeader.h"
#include "HttpReply.h"
-#include "Mem.h"
#include "MemObject.h"
#include "Store.h"
#include "StoreFileSystem.h"
#include "base/AsyncCallQueue.h"
#include "CapturingStoreEntry.h"
#include "event.h"
-#include "Mem.h"
#include "stat.h"
#include "testEvent.h"
#include "AsyncEngine.h"
#include "EventLoop.h"
-#include "Mem.h"
+#include "mem/forward.h"
#include "SquidTime.h"
#include "stat.h"
#include "testEventLoop.h"
#include "http/one/RequestParser.h"
#include "http/RequestMethod.h"
-#include "Mem.h"
#include "MemBuf.h"
#include "SquidConfig.h"
#include "testHttp1Parser.h"
#include "HttpHeader.h"
#include "HttpReply.h"
-#include "Mem.h"
#include "mime_header.h"
#include "SquidConfig.h"
#include "testHttpReply.h"
#include "HttpHeader.h"
#include "HttpRequest.h"
-#include "Mem.h"
#include "mime_header.h"
#include "testHttpRequest.h"
#include <cppunit/TestAssert.h>
#include "http/RequestMethod.h"
-#include "Mem.h"
#include "SquidConfig.h"
#include "testHttpRequestMethod.h"
#include "globals.h"
#include "HttpHeader.h"
#include "HttpReply.h"
-#include "Mem.h"
#include "MemObject.h"
#include "RequestFlags.h"
#include "SquidConfig.h"
#include "squid.h"
#include "base/CharacterSet.h"
-#include "Mem.h"
#include "SBuf.h"
#include "SBufFindTest.h"
#include "SBufStream.h"
*/
#include "squid.h"
-#include "Mem.h"
#include "MemObject.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "squid.h"
#include "CapturingStoreEntry.h"
-#include "Mem.h"
#include "Store.h"
#include "StoreEntryStream.h"
#include "testStore.h"
*/
#include "squid.h"
-#include "Mem.h"
#include "MemObject.h"
#include "SquidConfig.h"
#include "SquidTime.h"
#include "squid.h"
#include "event.h"
-#include "Mem.h"
#include "SquidString.h"
#include "testString.h"
#include <cppunit/TestAssert.h>
-#include "Mem.h"
#include "testURL.h"
#include "URL.h"
#include "globals.h"
#include "HttpHeader.h"
#include "HttpReply.h"
-#include "Mem.h"
#include "MemObject.h"
#include "RequestFlags.h"
#include "SquidConfig.h"
#include <cppunit/TestAssert.h>
#include "anyp/UriScheme.h"
-#include "Mem.h"
#include "SquidString.h"
#include "tests/testUriScheme.h"
/* DEBUG: section 64 HTTP Range Header */
#include "squid.h"
+#include "fatal.h"
#include "HttpHeader.h"
#include "HttpHeaderRange.h"
-#include "Mem.h"
/** \todo CLEANUP: This file should be called something_stub.cc */
#include "comm/Connection.h"
#include "comm/Loops.h"
#include "event.h"
+#include "fatal.h"
#include "SquidConfig.h"
#define WCCP_PORT 2048
#define SQUID_WORDLIST_H
#include "globals.h"
-#include "MemPool.h"
#include "profiler/Profiler.h"
#include "SBufList.h"
$(LDADD)
mem_node_test_SOURCES = mem_node_test.cc $(DEBUG_SOURCE)
-mem_node_test_LDADD = $(top_builddir)/src/mem_node.o $(LDADD)
+mem_node_test_LDADD = \
+ $(top_builddir)/src/mem_node.o \
+ $(top_builddir)/src/mem/libmem.la \
+ $(LDADD)
mem_hdr_test_SOURCES = mem_hdr_test.cc $(DEBUG_SOURCE)
mem_hdr_test_LDADD = \
$(top_builddir)/src/stmem.o \
$(top_builddir)/src/mem_node.o \
+ $(top_builddir)/src/mem/libmem.la \
$(LDADD)
MemPoolTest_SOURCES = MemPoolTest.cc $(DEBUG_SOURCE)