Add tools to help debug image GC (#4578)
`/debug-force-image-gc` will force garbage collection on all unused images `/debug-force-image-unload` will force unload all images Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -41,6 +41,7 @@ namespace detail {
|
||||
boost::optional<QPixmap> first() const;
|
||||
|
||||
private:
|
||||
int64_t memoryUsage() const;
|
||||
void processOffset();
|
||||
QVector<Frame<QPixmap>> items_;
|
||||
int index_{0};
|
||||
@@ -111,6 +112,7 @@ class ImageExpirationPool
|
||||
{
|
||||
private:
|
||||
friend class Image;
|
||||
friend class CommandController;
|
||||
|
||||
ImageExpirationPool();
|
||||
static ImageExpirationPool &instance();
|
||||
@@ -126,6 +128,12 @@ private:
|
||||
*/
|
||||
void freeOld();
|
||||
|
||||
/*
|
||||
* Debug function that unloads all images in the pool. This is intended to
|
||||
* test for possible memory leaks from tracked images.
|
||||
*/
|
||||
void freeAll();
|
||||
|
||||
private:
|
||||
// Timer to periodically run freeOld()
|
||||
QTimer *freeTimer_;
|
||||
|
||||
Reference in New Issue
Block a user