mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Partial Fix for Memory issue - Limiting the number of ImageSources cached (#4433)
* reducing storage of images * Added task.run * cleaned up code and added comments * Renamed variable * refactored code * Removed task.run because it was leading to race conditions in the concurrent dictionary and it was taking only upto 10 ms for reordering the dictionary * Added comments and fixed variable name
This commit is contained in:
@@ -185,9 +185,13 @@ namespace Wox.Infrastructure.Image
|
||||
string hash = EnableImageHash ? _hashGenerator.GetHashFromImage(img) : null;
|
||||
if (hash != null)
|
||||
{
|
||||
int ImageCacheValue;
|
||||
if (GuidToKey.TryGetValue(hash, out string key))
|
||||
{ // image already exists
|
||||
img = ImageCache[key];
|
||||
if(ImageCache.Usage.TryGetValue(path, out ImageCacheValue))
|
||||
{
|
||||
img = ImageCache[key];
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // new guid
|
||||
|
||||
Reference in New Issue
Block a user