/*
- * Copyright (C) 1996-2016 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.
*/
#include "mem/Meter.h"
-#include "splay.h"
#include "util.h"
#if HAVE_GNUMALLOC_H
class MemPoolStats;
/// \ingroup MemPoolsAPI
-/// \todo Kill this typedef for C++
+/// TODO: Kill this typedef for C++
typedef struct _MemPoolGlobalStats MemPoolGlobalStats;
/// \ingroup MemPoolsAPI
/**
\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.
*
* 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.
void clean(time_t maxage);
void setDefaultPoolChunking(bool const &);
- MemImplementingAllocator *pools;
- ssize_t mem_idle_limit;
- int poolCount;
- bool defaultIsChunked;
+
+ MemImplementingAllocator *pools = nullptr;
+ ssize_t mem_idle_limit = (2 << 20) /* 2MB */;
+ int poolCount = 0;
+ bool defaultIsChunked = false;
};
/**
};
/// \ingroup MemPoolsAPI
-/// \todo Classify and add constructor/destructor to initialize properly.
+/// TODO: Classify and add constructor/destructor to initialize properly.
struct _MemPoolGlobalStats {
MemPoolMeter *TheMeter;
};
/// \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);
/**
\ingroup MemPoolsAPI
- \todo Stats API - not sured how to refactor yet
*
- * Fills MemPoolGlobalStats with statistical data about overall
+ * Fills a 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);