You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicvoidFlushCache(){lock(_imageCache){foreach(var dxImage in _imageCache){
dxImage.Value?.Dispose();((ImageElement)dxImage.Key).Dispose();}foreach(var element in Overlays[0].Elements.OfType<ImageElement>()){DXImageresult= ToDispose(new DXImage(_device, _deviceContext));
result.Initialise(element.Bitmap);
_imageCache[element]=result;}}}
Upon further inspection using a bigger image, recreating a new ImageElement every frame does indeed create a memory leak.
Some code.
The bitmap created on start up:
var bm = new Bitmap(/* path to big image*/);
The main loop:
Same results can be achieved by just calling SetBitmap without a doublebuffer.
SetBitmap method, where
this.OverlayEngine.Overlays[0].Elements[1]
is anImageElement
Finally,
FlushCache
methodSharpDX.ObjectTracker output
Texture2D never goes above 50
The text was updated successfully, but these errors were encountered: