]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceLayout: shuffle memory pool allocators to mem/libmem.la
authorAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2014 04:05:48 +0000 (20:05 -0800)
committerAmos Jeffries <squid3@treenet.co.nz>
Mon, 1 Dec 2014 04:05:48 +0000 (20:05 -0800)
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.

145 files changed:
configure.ac
lib/Makefile.am
src/CacheDigest.cc
src/DiskIO/DiskThreads/CommIO.h
src/DiskIO/DiskThreads/DiskThreadsIOStrategy.cc
src/DiskIO/DiskThreads/aiops.cc
src/DiskIO/DiskThreads/async_io.cc
src/EventLoop.cc
src/HttpHdrCc.cc
src/HttpHdrCc.h
src/HttpHdrContRange.cc
src/HttpHdrSc.cc
src/HttpHdrScTarget.h
src/HttpHeader.cc
src/HttpHeader.h
src/HttpHeaderRange.h
src/Makefile.am
src/MemBlob.cc
src/MemBlob.h
src/MemBuf.cc
src/Notes.h
src/SquidList.cc
src/StoreMetaMD5.h
src/StoreMetaObjSize.h
src/StoreMetaSTD.h
src/StoreMetaSTDLFS.h
src/StoreMetaURL.h
src/StoreMetaVary.h
src/StoreSwapLogData.h
src/String.cc
src/URL.h
src/acl/Acl.cc
src/acl/Acl.h
src/acl/DomainData.cc
src/acl/Gadgets.cc
src/acl/HierCodeData.cc
src/acl/HttpHeaderData.h
src/acl/IntRange.cc
src/acl/NoteData.h
src/acl/RegexData.cc
src/acl/RegexData.h
src/acl/Strategised.h
src/acl/UserData.cc
src/adaptation/icap/Xaction.cc
src/auth/Acl.cc
src/auth/Gadgets.h
src/auth/UserRequest.cc
src/auth/basic/Config.cc
src/auth/basic/UserRequest.h
src/auth/digest/Config.cc
src/auth/digest/UserRequest.h
src/auth/negotiate/UserRequest.cc
src/auth/negotiate/UserRequest.h
src/auth/ntlm/UserRequest.cc
src/auth/ntlm/UserRequest.h
src/cache_cf.cc
src/cbdata.cc
src/client_db.cc
src/client_side.cc
src/clients/FtpClient.cc
src/clients/FtpGateway.cc
src/comm/Connection.h
src/disk.cc
src/dlink.cc
src/dns_internal.cc
src/esi/Esi.cc
src/esi/Sequence.h
src/esi/VarState.cc
src/event.h
src/fd.cc
src/fqdncache.cc
src/fs/rock/RockIoState.cc
src/gopher.cc
src/helper.cc
src/htcp.cc
src/http.cc
src/icmp/net_db.cc
src/icp_v2.cc
src/internal.cc
src/ipc/Port.cc
src/ipcache.cc
src/log/File.cc
src/log/ModDaemon.cc
src/log/ModStdio.cc
src/log/ModUdp.cc
src/log/TcpLogger.cc
src/main.cc
src/mem/AllocatorProxy.cc [new file with mode: 0644]
src/mem/AllocatorProxy.h [new file with mode: 0644]
src/mem/Makefile.am [new file with mode: 0644]
src/mem/Pool.cc [moved from lib/MemPool.cc with 88% similarity]
src/mem/Pool.h [moved from include/MemPool.h with 84% similarity]
src/mem/PoolChunked.cc [moved from lib/MemPoolChunked.cc with 98% similarity]
src/mem/PoolChunked.h [moved from include/MemPoolChunked.h with 87% similarity]
src/mem/PoolMalloc.cc [moved from lib/MemPoolMalloc.cc with 94% similarity]
src/mem/PoolMalloc.h [moved from include/MemPoolMalloc.h with 98% similarity]
src/mem/forward.h [moved from src/Mem.h with 71% similarity]
src/mem/old_api.cc [moved from src/mem.cc with 99% similarity]
src/mem_node.cc
src/mem_node.h
src/mime.cc
src/parser/Makefile.am
src/peer_digest.cc
src/peer_select.cc
src/refresh.cc
src/repl/lru/store_repl_lru.cc
src/snmp_agent.cc
src/snmp_core.cc
src/ssl/ErrorDetail.cc
src/ssl/bio.cc
src/ssl/cert_validate_message.cc
src/ssl/support.cc
src/stat.cc
src/store.cc
src/store_digest.cc
src/store_dir.cc
src/store_key_md5.cc
src/store_rebuild.cc
src/tests/CapturingStoreEntry.h
src/tests/Stub.list
src/tests/stub_libmem.cc [new file with mode: 0644]
src/tests/stub_mem.cc [deleted file]
src/tests/testAuth.cc
src/tests/testCacheManager.cc
src/tests/testConfigParser.cc
src/tests/testDiskIO.cc
src/tests/testEvent.cc
src/tests/testEventLoop.cc
src/tests/testHttp1Parser.cc
src/tests/testHttpReply.cc
src/tests/testHttpRequest.cc
src/tests/testHttpRequestMethod.cc
src/tests/testRock.cc
src/tests/testSBuf.cc
src/tests/testStoreController.cc
src/tests/testStoreEntryStream.cc
src/tests/testStoreHashIndex.cc
src/tests/testString.cc
src/tests/testURL.cc
src/tests/testUfs.cc
src/tests/testUriScheme.cc
src/tests/test_http_range.cc
src/wccp.cc
src/wordlist.h
test-suite/Makefile.am

index 818d06523606c7b626a4ac2ffa44fa661917893d..98a26e7ff8bf91f9345aa7fd2f589ea15f03ea8d 100644 (file)
@@ -3771,6 +3771,7 @@ AC_CONFIG_FILES([
        src/ident/Makefile
        src/ip/Makefile
        src/log/Makefile
+       src/mem/Makefile
        src/ipc/Makefile
        src/ssl/Makefile
        src/mgr/Makefile
index dce561a6a43ca3b4dcc095484cdc30a26b03d1a7..751545fcea885a0945bf1643a1ae9712d310c516 100644 (file)
@@ -65,9 +65,6 @@ libmisccontainers_la_SOURCES = \
        hash.cc
 
 libmiscutil_la_SOURCES = \
-       MemPool.cc \
-       MemPoolChunked.cc \
-       MemPoolMalloc.cc \
        getfullhostname.c \
        heap.c \
        iso3307.c \
index 9242e4bdc40c24de92c5bb217a50b010c7fa43a1..82f3eeb0d3bf33ebb816f86f64143f4d5c9533e1 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "squid.h"
 #include "md5.h"
-#include "Mem.h"
 #include "StatCounters.h"
 #include "Store.h"
 #include "store_key_md5.h"
@@ -18,6 +17,7 @@
 #if USE_CACHE_DIGESTS
 
 #include "CacheDigest.h"
+#include "util.h"
 
 /* local types */
 
index 098852b2c869dd1fc113ed620ae16d532b583506..e6d416979f460b9a4993c415a35cde637c1a9c4b 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
 #define SQUID_SRC_DISKIO_DISKTHREADS_COMMIO_H
 
+#include "fatal.h"
 #include "fde.h"
 #include "globals.h"
 
index 9bd7478c1d115ec4c385ef2af82d06aaf1b71882..5e882dd180e01dbce355766f42c99826dc60b532 100644 (file)
@@ -9,7 +9,6 @@
 /* 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)
 {
index a21c8681d7419ba13f80cc7161232fda86f5b395..86c5d4be7b4c8c89e2b91d178d9e3a8474aa32c2 100644 (file)
 #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>
index 8468e848fccb12064f1ca30b4614dea4b32d6186..290e72cbe2688fc4959dd50299a4b9cac0390e76 100644 (file)
 #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 {
index df750d2ec927f13e122de44e4441f2b87685db3c..f831bef17864b5eee0b1efa9e392533dcd6f05a2 100644 (file)
@@ -13,6 +13,7 @@
 #include "base/AsyncCallQueue.h"
 #include "Debug.h"
 #include "EventLoop.h"
+#include "fatal.h"
 #include "SquidTime.h"
 
 EventLoop *EventLoop::Running = NULL;
index 98de14a6acd54e8c00caca7e3b80b97be61471c4..70ed06c4a929f70ae93e28145ef776b71ff373a3 100644 (file)
@@ -18,6 +18,7 @@
 #include "StatHist.h"
 #include "Store.h"
 #include "StrList.h"
+#include "util.h"
 
 #include <map>
 
index 3448ad56b5ef349f61b7706639489ef1f607f822..88262c5f0bfaf86b22d4a89e7f8799f2181de3f4 100644 (file)
@@ -10,7 +10,7 @@
 #define SQUID_HTTPHDRCC_H
 
 #include "enums.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 #include "SquidString.h"
 
 class Packer;
index d369be820bebcd435b213d541ca611dd7b592938..d28057c3f65d03ed4969726e9e00763b076f931c 100644 (file)
@@ -13,7 +13,6 @@
 #include "enums.h"
 #include "HttpHdrContRange.h"
 #include "HttpHeaderTools.h"
-#include "Mem.h"
 
 /*
  *    Currently only byte ranges are supported
index a0eb608d30abc6a0fa8ba878a6bb0d308e9a1fd8..1343835fd5b9ca6b08efd78db477914b8d8a22ce 100644 (file)
@@ -17,6 +17,7 @@
 #include "HttpHeaderTools.h"
 #include "Store.h"
 #include "StrList.h"
+#include "util.h"
 
 #include <map>
 
index 49d3040a93f9e210c326327a487f16679c48b9c5..234100df1959b4eacc3cb918b26ac385394d1d45 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "defines.h"
 #include "dlink.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 #include "SquidString.h"
 #include "typedefs.h"
 
index 68e1e84799aeb8872695ffef3cf4020b3313ab5b..e029a8add7faaf9eb699644a0ef273bae10aceee 100644 (file)
@@ -28,6 +28,7 @@
 #include "Store.h"
 #include "StrList.h"
 #include "TimeOrTag.h"
+#include "util.h"
 
 #include <algorithm>
 
index a8a8dcfb9e96b6a942753cdedc40f09ce93ee2d0..63659fdcb52b05bc685b5d05642f46e819da4c82 100644 (file)
@@ -12,7 +12,7 @@
 #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>
index 20f101fc0c2fb051e76bcb5d222a36e986baeab7..482a21ec413378f4854f84627edb0e6031511a35 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef SQUID_HTTPHEADERRANGE_H
 #define SQUID_HTTPHEADERRANGE_H
 
-#include "MemPool.h"
+#include "mem/forward.h"
 #include "Packer.h"
 #include "Range.h"
 #include "SquidString.h"
index d565e6e3cbe5cacdc54b9bfe346d2a5849357b5b..955cad651309ff103215c93c4732ed8e503d4559 100644 (file)
@@ -47,8 +47,8 @@ LOADABLE_MODULES_SOURCES = \
        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
@@ -428,11 +428,8 @@ squid_SOURCES = \
        main.cc \
        MasterXaction.cc \
        MasterXaction.h \
-       Mem.h \
-       mem.cc \
        mem_node.cc \
        mem_node.h \
-       Mem.h \
        MemBuf.cc \
        MemObject.cc \
        MemObject.h \
@@ -640,6 +637,7 @@ squid_LDADD = \
        $(ADAPTATION_LIBS) \
        $(ESI_LIBS) \
        $(SNMP_LIBS) \
+       mem/libmem.la \
        $(top_builddir)/lib/libmisccontainers.la \
        $(top_builddir)/lib/libmiscencoding.la \
        $(top_builddir)/lib/libmiscutil.la \
@@ -712,7 +710,6 @@ recv_announce_SOURCES = recv-announce.cc
 ## 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 = \
@@ -722,8 +719,7 @@ ufsdump_SOURCES = \
        debug.cc \
        int.h \
        int.cc \
-       Mem.h \
-       mem.cc \
+       mem/forward.h \
        MemBuf.cc \
        MemBuf.h \
        Parsing.h \
@@ -1144,8 +1140,6 @@ tests_testHttpReply_SOURCES=\
        HttpReply.h \
        MasterXaction.cc \
        MasterXaction.h \
-       Mem.h \
-       tests/stub_mem.cc \
        RegexList.h \
        RegexList.cc \
        MemBuf.cc \
@@ -1212,6 +1206,7 @@ tests_testHttpReply_LDADD=\
        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 \
@@ -1329,8 +1324,7 @@ tests_testACLMaxUserIP_SOURCES= \
        tests/stub_time.cc \
        url.cc \
        URL.h \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        MemBuf.cc \
        wordlist.h \
        wordlist.cc
@@ -1395,8 +1389,6 @@ tests_testCacheManager_SOURCES = \
        RequestFlags.h \
        RequestFlags.cc \
        HttpRequest.cc \
-       Mem.h \
-       tests/stub_mem.cc \
        String.cc \
        tests/testCacheManager.cc \
        tests/testCacheManager.h \
@@ -1617,6 +1609,7 @@ tests_testCacheManager_LDADD = \
        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 \
@@ -1683,8 +1676,6 @@ tests_testDiskIO_SOURCES = \
        MemBuf.cc \
        MemObject.cc \
        mem_node.cc \
-       Mem.h \
-       tests/stub_mem.cc \
        Notes.h \
        Notes.cc \
        Packer.cc \
@@ -1800,6 +1791,7 @@ tests_testDiskIO_LDADD = \
        $(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 \
@@ -1915,8 +1907,7 @@ tests_testEvent_SOURCES = \
        SquidList.cc \
        MasterXaction.cc \
        MasterXaction.h \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        mem_node.cc \
        MemBuf.cc \
        MemObject.cc \
@@ -2162,8 +2153,7 @@ tests_testEventLoop_SOURCES = \
        MasterXaction.h \
        MemBuf.cc \
        MemObject.cc \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        mem_node.cc \
        mime.h \
        mime.cc \
@@ -2204,7 +2194,6 @@ tests_testEventLoop_SOURCES = \
        StatCounters.cc \
        StatHist.h \
        StatHist.cc \
-       Mem.h \
        stmem.cc \
        repl_modules.h \
        store.cc \
@@ -2403,8 +2392,7 @@ tests_test_http_range_SOURCES = \
        MasterXaction.h \
        MemBuf.cc \
        MemObject.cc \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        mem_node.cc \
        mime.h \
        mime.cc \
@@ -2549,8 +2537,7 @@ tests_testHttp1Parser_SOURCES = \
        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 \
@@ -2599,8 +2586,7 @@ tests_testHttpRequest_SOURCES = \
        RequestFlags.h \
        RequestFlags.cc \
        HttpRequest.cc \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        String.cc \
        tests/testHttpRequest.h \
        tests/testHttpRequest.cc \
@@ -2878,8 +2864,6 @@ tests_testStore_SOURCES= \
        SquidList.cc \
        MasterXaction.cc \
        MasterXaction.h \
-       Mem.h \
-       tests/stub_mem.cc \
        mem_node.cc \
        MemBuf.cc \
        MemObject.cc \
@@ -2993,6 +2977,7 @@ tests_testStore_LDADD= \
        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 \
@@ -3013,8 +2998,7 @@ tests_testStore_DEPENDENCIES = \
 ## 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) \
@@ -3166,8 +3150,6 @@ tests_testUfs_SOURCES = \
        HttpHeaderTools.cc \
        HttpHeader.h \
        HttpHeader.cc \
-       Mem.h \
-       mem.cc \
        ClientInfo.h \
        MemBuf.cc \
        HttpHdrContRange.cc \
@@ -3233,6 +3215,7 @@ tests_testUfs_LDADD = \
        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 \
@@ -3302,8 +3285,6 @@ tests_testRock_SOURCES = \
        SquidList.cc \
        MasterXaction.cc \
        MasterXaction.h \
-       Mem.h \
-       mem.cc \
        MemBuf.cc \
        MemObject.cc \
        mem_node.cc \
@@ -3413,6 +3394,7 @@ tests_testRock_LDADD = \
        $(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 \
@@ -3525,8 +3507,7 @@ tests_testURL_SOURCES = \
        MasterXaction.h \
        multicast.h \
        multicast.cc \
-       Mem.h \
-       tests/stub_mem.cc \
+       tests/stub_libmem.cc \
        mem_node.cc \
        MemBuf.cc \
        MemObject.cc \
@@ -3683,10 +3664,10 @@ tests_testSBuf_SOURCES= \
        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 \
@@ -3722,7 +3703,6 @@ tests_testSBufList_SOURCES= \
        tests/stub_SBufDetailedStats.cc \
        SBufStream.h \
        tests/stub_time.cc \
-       mem.cc \
        tests/stub_MemObject.cc \
        tests/stub_cbdata.cc \
        tests/stub_comm.cc \
@@ -3731,6 +3711,7 @@ tests_testSBufList_SOURCES= \
        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 \
@@ -3757,8 +3738,7 @@ tests_testSBufList_DEPENDENCIES= $(SQUID_CPPUNIT_LA)
 
 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) \
@@ -3813,8 +3793,7 @@ tests_testStatHist_SOURCES = \
        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 \
index 276b248d1813e820c6543a95b3a33ced631fded1..8b343276471229994db3d6e589211759de8a02e0 100644 (file)
@@ -9,7 +9,6 @@
 #include "squid.h"
 #include "base/TextException.h"
 #include "Debug.h"
-#include "Mem.h"
 #include "MemBlob.h"
 #include "SBufDetailedStats.h"
 
index d57d333ba3fe9226b4a22fce4fe04ce92825856c..63b18802bdcce150e055a6d1dceee64ad3f3e16d 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "base/InstanceId.h"
 #include "base/RefCount.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 
 /// Various MemBlob class-wide statistics.
 class MemBlobStats
index 2759e0e0cb44b022a97c59bea961b9c09bec22e4..051b19e1636232868a62d628ee20a88bf7bbffcc 100644 (file)
@@ -72,7 +72,7 @@
  */
 
 #include "squid.h"
-#include "Mem.h"
+#include "mem/forward.h"
 #include "MemBuf.h"
 #include "profiler/Profiler.h"
 
index 6f17e0f33402316c7e900fc096a8a015c256a346..9a292d442ce4a5af55a7b66c8f4fd0d5c387f8ec 100644 (file)
@@ -12,7 +12,7 @@
 #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"
 
index d7642676b610152e630db68f558edde2935cfce0..124ed86d9a9c56484afbb7ec9e2c58d565ac594c 100644 (file)
@@ -9,7 +9,7 @@
 /* DEBUG: none          Linked list functions (deprecated) */
 
 #include "squid.h"
-#include "Mem.h"
+#include "mem/forward.h"
 #include "SquidList.h"
 #include "typedefs.h"
 
index 72e89b5f1f14d238d873af73edfc5643f026660f..b5b76231b2fb6a21618bd286a91167cd8b34272e 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETAMD5_H
 #define SQUID_STOREMETAMD5_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 /* for STORE_META_KEY_MD5 */
 #include "enums.h"
index a7b6c298738c718283a786faf353aa3c8512d5bc..fab1f25eb2513f9d77f95d8ff63ab7424c65bc35 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETAOBJSIZE_H
 #define SQUID_STOREMETAOBJSIZE_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 
 class StoreMetaObjSize : public StoreMeta
index 377586a53d53bae49eb1f2149726d5c6b8592be5..327fb0a606f7478ab5807a88c9823b3e582bdb4b 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETASTD_H
 #define SQUID_STOREMETASTD_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 
 class StoreMetaSTD : public StoreMeta
index df82ea329836b4b9d74a0b506a107f0d8fda64f7..593e94e66b420aaeb6d0321bc34da6edccd9f775 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETASTDLFS_H
 #define SQUID_STOREMETASTDLFS_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 
 class StoreMetaSTDLFS : public StoreMeta
index f4c1f4a058b62efa00e6dea96d3ddd3e75e75f8a..6be7fcdee5c89c4c963c3999a7d8e6de25cf1e2b 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETAURL_H
 #define SQUID_STOREMETAURL_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 
 class StoreMetaURL : public StoreMeta
index e07c1415913f90f3b150fae55234fa73ef2fd150..f6a57c9f146e68b5d8b06c2019c6d2a3a79ebdd0 100644 (file)
@@ -9,7 +9,6 @@
 #ifndef SQUID_STOREMETAVARY_H
 #define SQUID_STOREMETAVARY_H
 
-#include "MemPool.h"
 #include "StoreMeta.h"
 
 class StoreMetaVary : public StoreMeta
index 3dcbfb5cf2867c04997cf79f7ff721569d3b39cd..2b15f6b87df9a9bca5d8afd902133a5b084fecb5 100644 (file)
@@ -36,7 +36,7 @@
  */
 
 #include "md5.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 #include "typedefs.h"
 
 /// maintains a 24-bit checksum over integer fields
index 0e0a0d90e716b80354118ce3519d1bae76a44a01..91bab6b434e283e6c6707a0529f5b6da59c3590a 100644 (file)
@@ -10,7 +10,6 @@
 
 #include "squid.h"
 #include "base/TextException.h"
-#include "Mem.h"
 #include "mgr/Registration.h"
 #include "profiler/Profiler.h"
 #include "Store.h"
index e1300da253d6a771091d9cfa2b851f7f4b0f1213..f58835f0714e9071bd6e35cc239b55b7edfe3aac 100644 (file)
--- a/src/URL.h
+++ b/src/URL.h
@@ -10,7 +10,6 @@
 #define SQUID_SRC_URL_H
 
 #include "anyp/UriScheme.h"
-#include "MemPool.h"
 #include "SBuf.h"
 
 /**
index cb34664c8fc1f6b8bcec11cadec4847d3a9651e3..83df0c8ff848db39ba31c4d88334e0b5b8e5c4d1 100644 (file)
@@ -17,6 +17,7 @@
 #include "ConfigParser.h"
 #include "Debug.h"
 #include "dlink.h"
+#include "fatal.h"
 #include "globals.h"
 #include "profiler/Profiler.h"
 #include "SquidConfig.h"
index 1c4582fcfbb81a1728042620617bf6a1ab0f658c..3cdc4fbb1c2bc8840c81cf0c9ad3a53f5587ec91 100644 (file)
@@ -13,7 +13,6 @@
 #include "cbdata.h"
 #include "defines.h"
 #include "dlink.h"
-#include "MemPool.h"
 #include "SBufList.h"
 
 #include <ostream>
index aca71e699dbc41b48ce25a8b982ae7586362f7a5..1924d661141ac36008516cec854ad4113d8ee953 100644 (file)
@@ -14,6 +14,7 @@
 #include "cache_cf.h"
 #include "Debug.h"
 #include "src/URL.h"
+#include "util.h"
 
 template<class T>
 inline void
index 545ea3bc96bccaab429a837f1e71a82ec6205614..b42b20dc003978603a36060d22a9dce7a8cb4bc1 100644 (file)
@@ -28,7 +28,6 @@
 #include "errorpage.h"
 #include "globals.h"
 #include "HttpRequest.h"
-#include "Mem.h"
 
 #include <set>
 #include <algorithm>
index 4587230049043157c4f054705dd0866733f4a291..8a6d1621ad057e34f8afb5faaec481c6390ec560 100644 (file)
@@ -10,6 +10,7 @@
 #include "acl/Checklist.h"
 #include "acl/HierCodeData.h"
 #include "cache_cf.h"
+#include "fatal.h"
 #include "hier_code.h"
 
 ACLHierCodeData::ACLHierCodeData()
index 8d7e259053d44a7e12c26767246e636f61d2f1ff..33aaed0e8b6a7b57387ebbe6a18eb29ba79131a0 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "acl/Data.h"
 #include "HttpHeader.h"
-#include "MemPool.h"
 #include "SquidString.h"
 
 class ACLHTTPHeaderData : public ACLData<HttpHeader*>
index d4dadff9e3d191ab589ee36969334a0bcff87bb4..9c4566dc2541975d12439463b134a98c8bc6be15 100644 (file)
@@ -12,6 +12,7 @@
 #include "acl/IntRange.h"
 #include "cache_cf.h"
 #include "Debug.h"
+#include "fatal.h"
 #include "Parsing.h"
 
 void
index 9bb8591b6e6ad662e576e7694e8d524b9438172c..cc362993e83b508ecd3af582dae70603d7b2d2f7 100644 (file)
@@ -10,7 +10,6 @@
 #define SQUID_ACLNOTEDATA_H
 
 #include "acl/Data.h"
-#include "MemPool.h"
 #include "SquidString.h"
 
 class HttpRequest;
index 84b01332d2c2d3f4238753e83b10785044c6e6ee..3256d2d8ed81374da1526c1ccf1ccd6d58e1055a 100644 (file)
@@ -20,7 +20,6 @@
 #include "acl/RegexData.h"
 #include "ConfigParser.h"
 #include "Debug.h"
-#include "Mem.h"
 #include "RegexList.h"
 #include "wordlist.h"
 
index d8a2a509b495ce132954bb5ba29e40db6b6d4fe7..95f84fecb8e5f82d1a2f8fb0ccafe9efab65d2e2 100644 (file)
@@ -10,7 +10,6 @@
 #define SQUID_ACLREGEXDATA_H
 
 #include "acl/Data.h"
-#include "MemPool.h"
 
 class RegexList;
 
index 57a78cb057fc8495021cc271402297be24818b7e..810cb31525e1731cf83cdd9aa97e3afd0b2ddc44 100644 (file)
@@ -8,20 +8,19 @@
 
 #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);
@@ -44,7 +43,6 @@ public:
     virtual ACL *clone()const;
 
 private:
-    static MemAllocator *Pool;
     ACLData<MatchType> *data;
     char const *type_;
     ACLStrategy<MatchType> *matcher;
@@ -52,29 +50,6 @@ private:
 
 /* 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()
 {
index 03412949e6664838730baeebe044dd11ac662460..1ad700f481cb04151edb9797bf67dc7a15378c26 100644 (file)
@@ -13,6 +13,7 @@
 #include "acl/UserData.h"
 #include "ConfigParser.h"
 #include "Debug.h"
+#include "util.h"
 
 template<class T>
 inline void
index 17035440eff424dda86349f0772c439c3ca4762b..e482dfca867b2435d035eac09730969aa1088778 100644 (file)
@@ -27,7 +27,6 @@
 #include "HttpRequest.h"
 #include "icap_log.h"
 #include "ipcache.h"
-#include "Mem.h"
 #include "pconn.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
index 480601404b4a191a06b23e7200b22e5619011efc..9c4fef36f6b292e616ef3b0d7d556ff18075d44a 100644 (file)
@@ -13,6 +13,7 @@
 #include "auth/AclProxyAuth.h"
 #include "auth/UserRequest.h"
 #include "client_side.h"
+#include "fatal.h"
 #include "HttpRequest.h"
 
 /**
index a7ee818cc630fbc04964edcea300515eaa954247..2f3b8a0b3b5fc00470cf57afb910fe31bdd73710 100644 (file)
@@ -14,7 +14,6 @@
 #include "auth/Config.h"
 #include "auth/User.h"
 #include "hash.h"
-#include "MemPool.h"
 
 /**
  \ingroup AuthAPI
index 78b07e46bb5d2dd7f3e60605a67b65c5fd61293b..8f0cafe86a0ba9074648abe0d6fdab594109fab6 100644 (file)
@@ -19,6 +19,7 @@
 #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"
index 1caa6f19bb982dc5b8a98d2a2090686b3b73c4f7..b93e4d4b57d202ddce49778c558c90bf26ba5da9 100644 (file)
@@ -28,6 +28,7 @@
 #include "rfc1738.h"
 #include "SquidTime.h"
 #include "Store.h"
+#include "util.h"
 #include "uudecode.h"
 #include "wordlist.h"
 
index 7ef90696aabcf15164542e7c12540398b1cbbd88..e200440c8156b83f48c81270051d35b96203ad57 100644 (file)
@@ -10,7 +10,6 @@
 #define _SQUID_SRC_AUTH_BASIC_USERREQUEST_H
 
 #include "auth/UserRequest.h"
-#include "MemPool.h"
 
 class ConnStateData;
 class HttpRequest;
index e58a29dd1a1eed77e7aafaf5ddfdd838237e0ff8..586a32016c681f9e154a8ebd523b9eada0bf7bb7 100644 (file)
 #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;
 
index b1e0e317aa79642cb5963fec6a057bce87538742..3cb2b2e21f5e95d56c058b7a247ef5c6fd7ce0cd 100644 (file)
@@ -10,7 +10,6 @@
 #define _SQUID_SRC_AUTH_DIGEST_USERREQUEST_H
 
 #include "auth/UserRequest.h"
-#include "MemPool.h"
 
 class ConnStateData;
 class HttpReply;
index 6575f5a6d91ba0f7686a685c8856284980208fe2..2f226f0676a6b6c5397338ede150378478402012 100644 (file)
@@ -13,6 +13,7 @@
 #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"
index c1f8db6f7a86bfa916fdf6824fb9d6af9a1d6db3..7f586b1472996983d5050183a89cfc227401bf4a 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "auth/UserRequest.h"
 #include "helper/forward.h"
-#include "MemPool.h"
 
 class ConnStateData;
 class HttpReply;
index c73cfa83f85ed6972b621945761773b5e7e5272f..055192aed93e2000872ed069d4a66562ef1fe5e9 100644 (file)
@@ -13,6 +13,7 @@
 #include "auth/State.h"
 #include "cbdata.h"
 #include "client_side.h"
+#include "fatal.h"
 #include "format/Format.h"
 #include "globals.h"
 #include "helper.h"
index 74d349246f65973545486aa01f9c8f073cfd54da..ea327c5575a160592396ceaaeaf6485767a9cf3d 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "auth/UserRequest.h"
 #include "helper/forward.h"
-#include "MemPool.h"
 
 class ConnStateData;
 class HttpReply;
index 6372c26579703b4b1158448756d224a56b1d02d8..1ef519d1c13db64890b877d38faa13ba2854a0df 100644 (file)
@@ -40,7 +40,6 @@
 #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"
@@ -60,6 +59,7 @@
 #include "StoreFileSystem.h"
 #include "SwapDir.h"
 #include "tools.h"
+#include "util.h"
 #include "wordlist.h"
 /* wccp2 has its own conditional definitions */
 #include "wccp2.h"
index 48882fb00e784d7e81ce33c87424e46bc6400382..2ebbdfc6c1b642174eb6e208a74003fbfe3aa93d 100644 (file)
@@ -26,6 +26,7 @@
 #include "Generic.h"
 #include "mgr/Registration.h"
 #include "Store.h"
+#include "mem/Pool.h"
 
 #include <climits>
 #if USE_CBDATA_DEBUG
index 7c4b19c2015ee60dc87aa15cdfaeba1f3e5a63d8..a5aa55daf0bf28165810445bf1f970d2ca46db95 100644 (file)
@@ -17,7 +17,6 @@
 #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"
index 32403ccd844daf507ad57f3d7e94ac31b529d51e..daffbc3c67e58ddf48cfc428ddd8bd5e75ffe260 100644 (file)
@@ -97,7 +97,6 @@
 #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>
index 8466fbaf15d7d92d3553292fd9479cfbca2b6519..75e8372f737fce2292eb201d2acdbceb94afd7f7 100644 (file)
@@ -20,7 +20,6 @@
 #include "fd.h"
 #include "ftp/Parsing.h"
 #include "ip/tools.h"
-#include "Mem.h"
 #include "SquidConfig.h"
 #include "SquidString.h"
 #include "StatCounters.h"
index 9409ea186548447d32914eb5f3e0786a4afea606..c91ae56e0a1d64035588117976ffd7f7cd04f8c0 100644 (file)
@@ -29,7 +29,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "ip/tools.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "mime.h"
 #include "rfc1738.h"
@@ -40,6 +39,7 @@
 #include "Store.h"
 #include "tools.h"
 #include "URL.h"
+#include "util.h"
 #include "wordlist.h"
 
 #if USE_DELAY_POOLS
index 30dcb193d8ea05bb33d35ea21d45632b299397b0..8a820318d51b01c8a32d6172a6850ff69e1e33f3 100644 (file)
@@ -15,7 +15,7 @@
 #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"
index 2bd3d927c6602f59ff185f55b78262abc81c28bc..e05fddcbb66481d36b3e6df22b23ebd36d0578b2 100644 (file)
@@ -14,7 +14,6 @@
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "profiler/Profiler.h"
 #include "StatCounters.h"
index fd535a16c45b1ec053c4a60f89c4049b7b69ba8e..feb923f0dbee38cef5881992508e01257ed6a00a 100644 (file)
@@ -9,8 +9,10 @@
 #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;
 
index 8650537dc8928902bcf618c5d4b8acdb611786f1..3f899278d08cc10c30532f42426f175fecd21972 100644 (file)
@@ -21,7 +21,6 @@
 #include "fd.h"
 #include "fde.h"
 #include "ip/tools.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "mgr/Registration.h"
 #include "rfc3596.h"
index 13f96a0279a7d6c203a41683a19d17a68161b042..b6044f9ce6e62ceecbde495cbac9a8b8837fd072 100644 (file)
@@ -34,7 +34,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "ip/Address.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "profiler/Profiler.h"
 #include "SquidConfig.h"
index c3e2ed33d5cb24e51a4894f690545dc762f712ee..e668497831530f22659ce0cc5f70ac040594829a 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "esi/Element.h"
 #include "esi/ElementList.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 
 /* esiSequence */
 
index 9218a01d335cad05dc299f097b29cabe6acc8b48..1091925a11098550cb0d892199a328b606142d3d 100644 (file)
@@ -10,8 +10,8 @@
 
 #include "squid.h"
 #include "esi/VarState.h"
+#include "fatal.h"
 #include "HttpReply.h"
-#include "Mem.h"
 
 CBDATA_TYPE (ESIVarState);
 FREE ESIVarStateFree;
index 5967b7af0002336b67f8fe526c77dfdb9fcac296..4046a16dd33c78a8a5c064c402e5453ca19318c9 100644 (file)
@@ -10,7 +10,7 @@
 #define SQUID_EVENT_H
 
 #include "AsyncEngine.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 
 class StoreEntry;
 
index 17d8d6ea12e6c5a73df8d15a1f6a8060170b621d..96e37ae39ab6732fecae6e7789bc1d6b80ffa69d 100644 (file)
--- a/src/fd.cc
+++ b/src/fd.cc
@@ -11,6 +11,7 @@
 #include "squid.h"
 #include "comm/Loops.h"
 #include "Debug.h"
+#include "fatal.h"
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"
index 5c0c3a6e90b7b080d955b319244080b9ed225f5b..45550ae4fcdf063a57b021e746a2c7d6c1a6f619 100644 (file)
 #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
index 34964d2882d44a094976e74859fb276b9b5463f8..e9a5f5494fb6537e0eb1a38fe5af9d1713564324 100644 (file)
@@ -18,7 +18,6 @@
 #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"
index f5634cbaebf047267dfb47659fe6b23f227eb4a2..17d9e129964d458aea3a850b75fa70be45cf1f53 100644 (file)
@@ -19,7 +19,6 @@
 #include "html_quote.h"
 #include "HttpReply.h"
 #include "HttpRequest.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "mime.h"
 #include "rfc1738.h"
index 2be10ada3e2f3f85113cd2745cb3f78d4902e8c5..cc371c759e242c7784ba717b7737178c36e8ba1b 100644 (file)
@@ -20,7 +20,6 @@
 #include "helper.h"
 #include "helper/Reply.h"
 #include "helper/Request.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "SquidIpc.h"
 #include "SquidMath.h"
@@ -28,6 +27,9 @@
 #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
index 1639f6db2fa27ac962f43d32faa92bcad1409fca..ceed3637d9160fbf7759c8246ba9cae30a88b6f9 100644 (file)
 #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;
index d296989f66a826ab06e573f9c4edce384b655c3a..2509a88eabd3e3b2f50b3d799bea2589c7f2547f 100644 (file)
@@ -55,6 +55,7 @@
 #include "StrList.h"
 #include "tools.h"
 #include "URL.h"
+#include "util.h"
 
 #if USE_AUTH
 #include "auth/UserRequest.h"
index 550a304bfdc813a3017d22447dea711d4d576eb5..b87d51a5d274633aa0ee7cc6b9e2becd809fc01a 100644 (file)
@@ -29,7 +29,6 @@
 #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"
index bdb9f1f21bde8d857b8bc25ffac4b21c4e07a402..9686aaae2246c76eb788e2203c834c5549c71221 100644 (file)
@@ -43,6 +43,9 @@
 #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);
index 31595950c1300dd06a776cd3c3c5521bd7563696..0dc3edd3e12a8653c060b7507378676e595dc501 100644 (file)
@@ -21,6 +21,7 @@
 #include "Store.h"
 #include "tools.h"
 #include "URL.h"
+#include "util.h"
 #include "wordlist.h"
 
 /* called when we "miss" on an internal object;
index 5a95a5aa57756eeb41f60c45fd4f464de15c6757..0b0e213411bc3fc2df85646065b777550d0bf271 100644 (file)
@@ -15,6 +15,7 @@
 #include "CommCalls.h"
 #include "ipc/Port.h"
 #include "tools.h"
+#include "util.h"
 
 static const char channelPathPfx[] = DEFAULT_STATEDIR "/";
 static const char coordinatorAddrLabel[] = "-coordinator";
index d48b5fa9d65437dad8e33cb8ccd5977dd3ebf1d0..8cdccb991da7d36c3e65feda51013ffea3148c84 100644 (file)
@@ -17,7 +17,6 @@
 #include "ip/Address.h"
 #include "ip/tools.h"
 #include "ipcache.h"
-#include "Mem.h"
 #include "mgr/Registration.h"
 #include "rfc3596.h"
 #include "SquidConfig.h"
@@ -25,6 +24,7 @@
 #include "SquidTime.h"
 #include "StatCounters.h"
 #include "Store.h"
+#include "util.h"
 #include "wordlist.h"
 
 #if SQUID_SNMP
index 5d324220bf9287c1c31878105170d3cb9455505c..a18718e8010fa582f75eae22491cb395189f3b9f 100644 (file)
@@ -9,6 +9,7 @@
 /* DEBUG: section 50    Log file handling */
 
 #include "squid.h"
+#include "fatal.h"
 #include "fde.h"
 #include "log/File.h"
 #include "log/ModDaemon.h"
index 6811b306672cab1bb24e1bca3eca786afb39755c..92feda3a3a25b1fbccbd98f844b71a2c9910de3e 100644 (file)
@@ -11,6 +11,7 @@
 #include "squid.h"
 #include "cbdata.h"
 #include "comm/Loops.h"
+#include "fatal.h"
 #include "fde.h"
 #include "globals.h"
 #include "log/Config.h"
index c5b0faa898150bf321708c098eec5125eefafdaa..3b9b85c8fa27f2d008bf6b885720010d804b1501 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "squid.h"
 #include "disk.h"
+#include "fatal.h"
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"
index 76a2d0237df02ee782750fb97f2268a6c1e2c103..e295259d165f059f127b5178fa9d4bdfffa61b2e 100644 (file)
@@ -12,6 +12,7 @@
 #include "comm.h"
 #include "comm/Connection.h"
 #include "disk.h"
+#include "fatal.h"
 #include "fd.h"
 #include "log/File.h"
 #include "log/ModUdp.h"
index 2077be80a7e3635e546a87f3c9a3d3c3b36502d8..8b58aa062fc55c8ca8053e52b6070489d0d5cf76 100644 (file)
@@ -12,6 +12,7 @@
 #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"
index c0705399701489cc45e594334e0bb7f5bd3fc005..1ed2e287338353562075d43f4b8caf777212cb99 100644 (file)
@@ -47,8 +47,6 @@
 #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"
diff --git a/src/mem/AllocatorProxy.cc b/src/mem/AllocatorProxy.cc
new file mode 100644 (file)
index 0000000..a180706
--- /dev/null
@@ -0,0 +1,47 @@
+#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);
+}
diff --git a/src/mem/AllocatorProxy.h b/src/mem/AllocatorProxy.h
new file mode 100644 (file)
index 0000000..371a37f
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * 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 */
diff --git a/src/mem/Makefile.am b/src/mem/Makefile.am
new file mode 100644 (file)
index 0000000..e3a4cb5
--- /dev/null
@@ -0,0 +1,23 @@
+## 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
similarity index 88%
rename from lib/MemPool.cc
rename to src/mem/Pool.cc
index 31be72e2d7b0093d4e30a8fd2fa42fba8cf032bb..06aa4f828f64e1555584de9032cb223759dcdd20 100644 (file)
  */
 
 #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 &
@@ -324,62 +315,6 @@ memPoolsTotalAllocated(void)
     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),
similarity index 84%
rename from include/MemPool.h
rename to src/mem/Pool.h
index 559c3a9863b158bfbb695a90e042761548eab86f..1ea029cdc611bd493d0dfa1759e4d8e40dfb36a4 100644 (file)
  *     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 */
@@ -244,67 +238,6 @@ private:
     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
 {
@@ -429,8 +362,4 @@ extern int memPoolInUseCount(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_ */
similarity index 98%
rename from lib/MemPoolChunked.cc
rename to src/mem/PoolChunked.cc
index 89ba20c9eb4535465fda0d333085a2cf2b904473..cee007256fe5b1c5eb247bc49509da8a53ad99f0 100644 (file)
  */
 
 #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 */
similarity index 87%
rename from include/MemPoolChunked.h
rename to src/mem/PoolChunked.h
index 0e5896748d19bf39c0400504b8406f1ccdefff48..826504cb7b24cc5d47bbc27485e623e4b48ef4ed 100644 (file)
@@ -9,18 +9,10 @@
 #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;
 
similarity index 94%
rename from lib/MemPoolMalloc.cc
rename to src/mem/PoolMalloc.cc
index c761c0e8ee7da24534e981e33ee5ce5ec2bd6f76..9bf19e3813a3f575bcd94c3dcfa38c312343ebe6 100644 (file)
  */
 
 #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 *
similarity index 98%
rename from include/MemPoolMalloc.h
rename to src/mem/PoolMalloc.h
index 8d1364ec712530c0fd17182f671db37323e5e856..0ee27411b913724298d1cb8687bc263961c048e8 100644 (file)
@@ -28,7 +28,7 @@
  *     might be the way to go.
  */
 
-#include "MemPool.h"
+#include "mem/Pool.h"
 
 #include <stack>
 
similarity index 71%
rename from src/Mem.h
rename to src/mem/forward.h
index dc416544112070560e114825727efefa6ba5e4f1..65d95e6bd5aa034750156147bb93ba1703a5760a 100644 (file)
--- a/src/Mem.h
@@ -8,11 +8,12 @@
 
 /* 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"
 
@@ -22,19 +23,14 @@ class StoreEntry;
 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;
@@ -54,6 +50,5 @@ FREE *memFreeBufFunc(size_t size);
 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 */
similarity index 99%
rename from src/mem.cc
rename to src/mem/old_api.cc
index 5aba08010c1fcf19fa3e4146966a735264e8b2da..f264db09d113717923819534caa99f4c2a8d7dca 100644 (file)
 #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"
@@ -459,9 +460,9 @@ Mem::Init(void)
     }
 
     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
@@ -473,12 +474,6 @@ Mem::Report()
            " MB");
 }
 
-void
-Mem::RegisterWithCacheManager(void)
-{
-    Mgr::RegisterAction("mem", "Memory Utilization", Mem::Stats, 0, 1);
-}
-
 mem_type &operator++ (mem_type &aMem)
 {
     int tmp = (int)aMem;
index df261e04b96fec1bf0267a768bee4e9a2ebec13e..f8e1fc860b3945b6286f08782e9fa953580b7187 100644 (file)
@@ -9,6 +9,7 @@
 /* DEBUG: section 19    Store Memory Primitives */
 
 #include "squid.h"
+#include "mem/Pool.h"
 #include "mem_node.h"
 
 static ptrdiff_t makeMemNodeDataOffset();
index 9e3235aedd0a6dfbc550e5be4da1103b9ed3e36c..d54da68588c1c2acf773b6f612d76f1b1164cffa 100644 (file)
@@ -10,7 +10,7 @@
 #define SQUID_MEM_NODE_H
 
 #include "defines.h"
-#include "MemPool.h"
+#include "mem/forward.h"
 #include "Range.h"
 #include "StoreIOBuffer.h"
 
index cdc0caf693625da6b3e191016bfbad24d01f7358..1b5372b66f5ca3e310dd88cc362d1c21ea03e961 100644 (file)
@@ -16,7 +16,6 @@
 #include "HttpReply.h"
 #include "HttpRequest.h"
 #include "internal.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "MemObject.h"
 #include "mime.h"
index 09d1e148a2234645e664257bf1c29797169cc57e..d3574ae5cd39e3a678a8f93456afb3e1ae50c19e 100644 (file)
@@ -41,7 +41,7 @@ testTokenizer_SOURCES = \
        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
index c3f81954cd2a016d4d5230e2d1830e25c734a1e9..cb7690e5e38827c1776e5e73555844cbef31a086 100644 (file)
@@ -27,6 +27,7 @@
 #include "store_key_md5.h"
 #include "StoreClient.h"
 #include "tools.h"
+#include "util.h"
 
 /* local types */
 
index def4c94e6c19fe129bc5c248a0a9b40801f86173..0470784e8698df17cb916bebd97b3ca5e7e4721c 100644 (file)
@@ -25,7 +25,6 @@
 #include "ICP.h"
 #include "ip/tools.h"
 #include "ipcache.h"
-#include "Mem.h"
 #include "neighbors.h"
 #include "peer_sourcehash.h"
 #include "peer_userhash.h"
index e58917b918457b7c6d3763ae577c411cf51b6e17..9ccb62a5e9d08cbe343290116121dbd1fcdc1088 100644 (file)
@@ -23,6 +23,7 @@
 #include "SquidTime.h"
 #include "Store.h"
 #include "URL.h"
+#include "util.h"
 
 typedef enum {
     rcHTTP,
index dbc2e319f0fdf063325794c73f8b49299b626099..3e0a9553eb3ffc2b7b04562b8e9d40e1e81ed0fb 100644 (file)
 #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 {
index 588858cddb00bb41e52627d2284203501e5c3dd5..b7e0aec3a3ca061344866b6a15af8d34b8829c57 100644 (file)
@@ -24,6 +24,8 @@
 #include "StatHist.h"
 #include "Store.h"
 #include "tools.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
 
 /************************************************************************
 
index 483be13d060470a7d5dd358fe3da6f216e78d7f8..352832a613af96d346e267d89369efb3e5a261bb 100644 (file)
@@ -17,6 +17,7 @@
 #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"
index 2684a94e2400131dc0002bfa7c91c4193577c004..b59f1d1f575e6f20446b90fc46eeac9deac03476 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "squid.h"
 #include "errorpage.h"
+#include "fatal.h"
 #include "ssl/ErrorDetail.h"
 
 #include <climits>
index 75c810d07eec56073fbf43512f29ef943c79a771..6d37124032ce7f230ccab9299d88b6ca7c912658 100644 (file)
@@ -18,7 +18,6 @@
 #include "fde.h"
 #include "globals.h"
 #include "ip/Address.h"
-#include "Mem.h"
 #include "ssl/bio.h"
 
 #if HAVE_OPENSSL_SSL_H
index f0d9f8ebdc912f5ef24177aeebaeb17746046dea..d9037aa5e4cbd66ac7f1a912b14de9c6c5e8c506 100644 (file)
@@ -13,6 +13,7 @@
 #include "ssl/cert_validate_message.h"
 #include "ssl/ErrorDetail.h"
 #include "ssl/support.h"
+#include "util.h"
 
 void
 Ssl::CertValidationMsg::composeRequest(CertValidationRequest const &vcert)
index 550c093c5934e1d75e6320b9d72a831cc13e4706..86ff0583665ac33e9c088e5df79d83360faa1b63 100644 (file)
@@ -17,6 +17,7 @@
 
 #include "acl/FilledChecklist.h"
 #include "anyp/PortCfg.h"
+#include "fatal.h"
 #include "fd.h"
 #include "fde.h"
 #include "globals.h"
index feb5c6ef36770c87ab86099f33b644540f1e61d8..2d3f3cc8decaf94aba8a18e01186c0e36322c8c6 100644 (file)
@@ -21,6 +21,7 @@
 #include "globals.h"
 #include "HttpRequest.h"
 #include "IoStats.h"
+#include "mem/Pool.h"
 #include "mem_node.h"
 #include "MemBuf.h"
 #include "MemObject.h"
@@ -42,6 +43,8 @@
 #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
index e75bf67e1024208d6f7e56613109b7c2865092a8..d576194fe18b64ad397c8f2d6887abb531849eb5 100644 (file)
 #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>
 
index 8a7e405b3d91c79bfec06807c206e59662bc6b03..9a79e1fe374fe0d3a8a6b99951b1dab6eaf31c13 100644 (file)
@@ -33,6 +33,7 @@
 #include "SquidTime.h"
 #include "Store.h"
 #include "StoreSearch.h"
+#include "util.h"
 
 #include <cmath>
 
index c79954102e8b267d3cac0b84fb98848b2599b233..3a54bf0d009b6aa141aa0feeb6be2e74cfc0ae3b 100644 (file)
@@ -24,6 +24,8 @@
 #include "SwapDir.h"
 #include "tools.h"
 #include "Transients.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
 
 #include <cerrno>
 #include <climits>
index faae363591620341be78f15b43e459818f2eab88..0e636b11900365782f24411919bfd46a66a9c693 100644 (file)
@@ -11,7 +11,6 @@
 #include "squid.h"
 #include "HttpRequest.h"
 #include "md5.h"
-#include "Mem.h"
 #include "store_key_md5.h"
 #include "URL.h"
 
index 4b5b634bbf9dda6c4a7e767e0ef43a1c0d6f3a02..631e27a1f298b4169e7f545338c32d8fc6290576 100644 (file)
@@ -21,6 +21,8 @@
 #include "store_rebuild.h"
 #include "StoreSearch.h"
 #include "SwapDir.h"
+// for tvSubDsec() which should be in SquidTime.h
+#include "util.h"
 
 #include <cerrno>
 
index 6b5cb783628af58d69eaf10b95538fbac5916bac..e95a1c0fc864c805b66ba1c4e216f5efb708d112 100644 (file)
@@ -9,7 +9,6 @@
 #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 */
index 1d3d446d8fc8474b0d9f4c18a4ef052711edf6fe..6cc84f639ad0e47a109b4b0f2659383d2e81df26 100644 (file)
@@ -50,7 +50,7 @@ STUB_SOURCE= tests/STUB.h \
        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 \
diff --git a/src/tests/stub_libmem.cc b/src/tests/stub_libmem.cc
new file mode 100644 (file)
index 0000000..509dafd
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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)
diff --git a/src/tests/stub_mem.cc b/src/tests/stub_mem.cc
deleted file mode 100644 (file)
index 47a5205..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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
index 95391ba5daa29129ad6e900430577ef7d5bbbcb9..c92e00035634e3281a0fade6f019bc1bd6cbcd02 100644 (file)
@@ -15,7 +15,6 @@
 #include "auth/Scheme.h"
 #include "auth/UserRequest.h"
 #include "ConfigParser.h"
-#include "Mem.h"
 #include "testAuth.h"
 
 CPPUNIT_TEST_SUITE_REGISTRATION( testAuth );
index 1b38aeb2b95c464ce67605cccedc209acc78ee5d..7219a3e635390aecc83fdb6aadafefbc95dbe97a 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "squid.h"
 #include "CacheManager.h"
-#include "Mem.h"
 #include "mgr/Action.h"
 #include "Store.h"
 #include "testCacheManager.h"
index 9a02917d4242f9cff8c4284a3a60723c7b7c8e9f..a98f9297f5aafc9297b3cfc399a6b2840b514699 100644 (file)
@@ -9,7 +9,6 @@
 #include "squid.h"
 #include "ConfigParser.h"
 #include "event.h"
-#include "Mem.h"
 #include "SquidString.h"
 #include "testConfigParser.h"
 
index 6e92fb7bcd4dde0a59e6151b575a949b1017cbda..a43d939f4b4cd6e49a9a93eaa306dc9ba2fbdb8b 100644 (file)
@@ -10,7 +10,6 @@
 #include "DiskIO/DiskIOModule.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
-#include "Mem.h"
 #include "MemObject.h"
 #include "Store.h"
 #include "StoreFileSystem.h"
index 61855885ec1620fce28a77f540a8777b2e0bb9ed..702e55ba211dab69dee280a776dd543acfa8b585 100644 (file)
@@ -13,7 +13,6 @@
 #include "base/AsyncCallQueue.h"
 #include "CapturingStoreEntry.h"
 #include "event.h"
-#include "Mem.h"
 #include "stat.h"
 #include "testEvent.h"
 
index 5aa5df57183a1c17adac7acbde1137095f002114..9d8586de5461a1e27723035a3e988e69b05e4dfd 100644 (file)
@@ -12,7 +12,7 @@
 
 #include "AsyncEngine.h"
 #include "EventLoop.h"
-#include "Mem.h"
+#include "mem/forward.h"
 #include "SquidTime.h"
 #include "stat.h"
 #include "testEventLoop.h"
index a3f01eb860f80a9e497793f753c7352c80bf2989..506d5c29113f7bd54ff9467507b493412d239fa8 100644 (file)
@@ -15,7 +15,6 @@
 
 #include "http/one/RequestParser.h"
 #include "http/RequestMethod.h"
-#include "Mem.h"
 #include "MemBuf.h"
 #include "SquidConfig.h"
 #include "testHttp1Parser.h"
index fb0ee4047480a9b07d54944fa833ef3eff7e0e2c..12a564cea9cf6918358e201e44d7c78ce63ddccc 100644 (file)
@@ -11,7 +11,6 @@
 
 #include "HttpHeader.h"
 #include "HttpReply.h"
-#include "Mem.h"
 #include "mime_header.h"
 #include "SquidConfig.h"
 #include "testHttpReply.h"
index e9adf2850b9f9a8e2233593a58e2e2face77c335..8120609d0ce2e09e8645a616e70bba789ef7613c 100644 (file)
@@ -12,7 +12,6 @@
 
 #include "HttpHeader.h"
 #include "HttpRequest.h"
-#include "Mem.h"
 #include "mime_header.h"
 #include "testHttpRequest.h"
 
index 4b94d2606f128727776e86455419735b5d6150fd..52392f14dc55cb08ae5557c0a710c17694eeb176 100644 (file)
@@ -10,7 +10,6 @@
 #include <cppunit/TestAssert.h>
 
 #include "http/RequestMethod.h"
-#include "Mem.h"
 #include "SquidConfig.h"
 #include "testHttpRequestMethod.h"
 
index 4f9c7a27c3920d447d024786c106bd3cfaad06bd..d66ee5520660ef3ec21bb6191e919ce2441abbdf 100644 (file)
@@ -13,7 +13,6 @@
 #include "globals.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
-#include "Mem.h"
 #include "MemObject.h"
 #include "RequestFlags.h"
 #include "SquidConfig.h"
index 93d6dc26238c86f957fce80f2b74e160af3a22ab..945f315823096519f36c2f578652bb50a7844037 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "squid.h"
 #include "base/CharacterSet.h"
-#include "Mem.h"
 #include "SBuf.h"
 #include "SBufFindTest.h"
 #include "SBufStream.h"
index 68e0b0f6a9c4397ceaf5c37b3e0dd8c28fa003fe..74a66e633ff1642ea2fb91fb54825e84d1174ba0 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include "squid.h"
-#include "Mem.h"
 #include "MemObject.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
index 760042f2fd8972830b95540fd91b921a6c3676de..2be76f5d1953b4a23c75706c618df9bf09dc5431 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "squid.h"
 #include "CapturingStoreEntry.h"
-#include "Mem.h"
 #include "Store.h"
 #include "StoreEntryStream.h"
 #include "testStore.h"
index 7d0adb3a9dce1c358e3d33f7f13c3300cba0fb94..09c08365eddbeff905ae60c073714050081f3cc1 100644 (file)
@@ -7,7 +7,6 @@
  */
 
 #include "squid.h"
-#include "Mem.h"
 #include "MemObject.h"
 #include "SquidConfig.h"
 #include "SquidTime.h"
index 19dea2029d1c8f95dd9f4dcfb732cf9e35676fc8..b0c31bca81523eb94d4a2d14bba1560b58129bd2 100644 (file)
@@ -8,7 +8,6 @@
 
 #include "squid.h"
 #include "event.h"
-#include "Mem.h"
 #include "SquidString.h"
 #include "testString.h"
 
index 3bf7b6ff5207bf4087759d6f52b84fd093897c4a..a82a1ea0554076c7ec84d33999d87cada53dc60b 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <cppunit/TestAssert.h>
 
-#include "Mem.h"
 #include "testURL.h"
 #include "URL.h"
 
index 6556934769b3efc93329dc1051d35cd77222f500..5ca295338c91f87bf651dbded8a13c48ee167458 100644 (file)
@@ -12,7 +12,6 @@
 #include "globals.h"
 #include "HttpHeader.h"
 #include "HttpReply.h"
-#include "Mem.h"
 #include "MemObject.h"
 #include "RequestFlags.h"
 #include "SquidConfig.h"
index 24b0784633f88e0ca71fc763e4bce8b05d405686..78a254845b8aa3e11da59f66febc29817c81036a 100644 (file)
@@ -11,7 +11,6 @@
 #include <cppunit/TestAssert.h>
 
 #include "anyp/UriScheme.h"
-#include "Mem.h"
 #include "SquidString.h"
 #include "tests/testUriScheme.h"
 
index 9d7647f5c73d38767746fc5004d608ff1d84d1e1..3dc410576598c41ed67d524a6dca0b34b91594e3 100644 (file)
@@ -9,9 +9,9 @@
 /* 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 */
 
index 1325f2ca0620a9941b9bf3b52089886d212e1d90..8aefa8a562eb2fcbd0d32f0ab9a591adf5589a12 100644 (file)
@@ -15,6 +15,7 @@
 #include "comm/Connection.h"
 #include "comm/Loops.h"
 #include "event.h"
+#include "fatal.h"
 #include "SquidConfig.h"
 
 #define WCCP_PORT 2048
index 916fca52a6059dcfcfc53d65e0f005813f42b3cf..302d2081c9927fbdbb49a1e819d5e7b54a56596a 100644 (file)
@@ -10,7 +10,6 @@
 #define SQUID_WORDLIST_H
 
 #include "globals.h"
-#include "MemPool.h"
 #include "profiler/Profiler.h"
 #include "SBufList.h"
 
index 8daaa1d7a14d52a7f6451658080c58d8e582c179..8bb56e64f30ee19d11b4fd1a1063d4e6d9e0d674 100644 (file)
@@ -91,12 +91,16 @@ ESIExpressions_LDADD = $(top_builddir)/src/esi/Expression.o \
                $(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)