]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/mem/Pool.h
Maintenance: Remove FIXME and \todo labels (#647)
[thirdparty/squid.git] / src / mem / Pool.h
index 5face24628701caf60dcee3f59c4e7d7bb3cd8ce..a0a3177168786903d90ef5b8d8eeb0df297d5359 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
  *
  * Squid software is distributed under GPLv2+ license and includes
  * contributions from numerous individuals and organizations.
@@ -29,7 +29,6 @@
  */
 
 #include "mem/Meter.h"
-#include "splay.h"
 #include "util.h"
 
 #if HAVE_GNUMALLOC_H
@@ -63,7 +62,7 @@ class MemImplementingAllocator;
 class MemPoolStats;
 
 /// \ingroup MemPoolsAPI
-/// \todo Kill this typedef for C++
+/// TODO: Kill this typedef for C++
 typedef struct _MemPoolGlobalStats MemPoolGlobalStats;
 
 /// \ingroup MemPoolsAPI
@@ -119,7 +118,6 @@ class MemPools
 public:
     static MemPools &GetInstance();
     MemPools();
-    void init();
     void flushMeters();
 
     /**
@@ -140,7 +138,7 @@ public:
     /**
      \par
      * Main cleanup handler. For MemPools to stay within upper idle limits,
-     * this function needs to be called periodically, preferrably at some
+     * this function needs to be called periodically, preferably at some
      * constant rate, eg. from Squid event. It looks through all pools and
      * chunks, cleans up internal states and checks for releasable chunks.
      *
@@ -158,7 +156,7 @@ public:
      * Suitable frequency for cleanup is in range of few tens of seconds to
      * few minutes, depending of memory activity.
      *
-     \todo DOCS: Re-write this shorter!
+     * TODO: DOCS: Re-write this shorter!
      *
      \param maxage   Release all totally idle chunks that
      *               have not been referenced for maxage seconds.
@@ -166,12 +164,11 @@ public:
     void clean(time_t maxage);
 
     void setDefaultPoolChunking(bool const &);
-    MemImplementingAllocator *pools;
-    ssize_t mem_idle_limit;
-    int poolCount;
-    bool defaultIsChunked;
-private:
-    static MemPools *Instance;
+
+    MemImplementingAllocator *pools = nullptr;
+    ssize_t mem_idle_limit = (2 << 20) /* 2MB */;
+    int poolCount = 0;
+    bool defaultIsChunked = false;
 };
 
 /**
@@ -302,7 +299,7 @@ public:
 };
 
 /// \ingroup MemPoolsAPI
-/// \todo Classify and add constructor/destructor to initialize properly.
+/// TODO: Classify and add constructor/destructor to initialize properly.
 struct _MemPoolGlobalStats {
     MemPoolMeter *TheMeter;
 
@@ -324,13 +321,14 @@ struct _MemPoolGlobalStats {
 };
 
 /// \ingroup MemPoolsAPI
+/// Creates a named MemPool of elements with the given size
 #define memPoolCreate MemPools::GetInstance().create
 
 /* Allocator API */
 /**
  \ingroup MemPoolsAPI
  * Initialise iteration through all of the pools.
\retval  Iterator for use by memPoolIterateNext() and memPoolIterateDone()
* \returns Iterator for use by memPoolIterateNext() and memPoolIterateDone()
  */
 extern MemPoolIterator * memPoolIterate(void);
 
@@ -348,18 +346,17 @@ extern void memPoolIterateDone(MemPoolIterator ** iter);
 
 /**
  \ingroup MemPoolsAPI
- \todo Stats API - not sured how to refactor yet
  *
- * Fills MemPoolGlobalStats with statistical data about overall
+ * Fills MemPoolGlobalStats with statistical data about overall
  * usage for all pools.
  *
- \retval  Number of pools that have at least one object in use.
+ * \param stats   Object to be filled with statistical data.
+ *
+ * \return Number of pools that have at least one object in use.
  *        Ie. number of dirty pools.
  */
 extern int memPoolGetGlobalStats(MemPoolGlobalStats * stats);
 
-/// \ingroup MemPoolsAPI
-extern int memPoolInUseCount(MemAllocator *);
 /// \ingroup MemPoolsAPI
 extern int memPoolsTotalAllocated(void);