global: implemented rudimentary memory manager to use available system memory
without forcing the OS to page swap
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef MEMORYMANAGER_H
|
||||
#define MEMORYMANAGER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MemoryManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MemoryManager(QObject* parent = nullptr);
|
||||
|
||||
static void CreateInstance();
|
||||
static MemoryManager* instance();
|
||||
static void DestroyInstance();
|
||||
|
||||
static bool ShouldFreeMemory();
|
||||
|
||||
public slots:
|
||||
void ConsumedMemory();
|
||||
|
||||
signals:
|
||||
void FreeMemory();
|
||||
|
||||
private:
|
||||
static uint64_t GetAvailableMemory();
|
||||
|
||||
static MemoryManager* instance_;
|
||||
|
||||
static const uint64_t minimum_available_memory_;
|
||||
|
||||
};
|
||||
|
||||
#endif // MEMORYMANAGER_H
|
||||
Reference in New Issue
Block a user