wpf - Image edit and save Out of Memory Exception C# -
i'm working in wpf application show images in 2 places means same image gets loaded in 2 places. in 1 of place image shown along other few images in slider able edit , save. if there no image available in location should showing separate image image not found not editable. when started working on functionality got used process exception during edit , save. after searching came solution , @ rare time out of memory exception when click next or previous or first or last in slider. slider image control 4 buttons. when buttons clicked below method called. i'm not sure if there memory leaks. bool noimage = true; private static readonly object _syncroot = new object(); private bitmapsource loadimage(string path) { lock (_syncroot) //lock object doesn't executed more once @ time. { bitmapdecoder decoder = null; try { //if image not found in folder, show image not found. if (!file.exists(path) && (path != null)...