Won't Fix
Last Updated: 04 Apr 2024 12:23 by ADMIN
ADMIN
Todor
Created on: 11 May 2015 12:23
Category: ImageEditor
Type: Bug Report
8
ImageEditor: Unmanaged memory leak when multiple operations are applied on a RadBitmap
Multiple operations applied on a big RadBitmap can cause OutOfMemoryException because of used and not disposed unmanaged resources in a WriteableBitmap object.

Steps to reproduce:
- Execute multiple times the Rotate tool
Observe: The memory goes up and retains such.
Expected: The unmanaged memory is cleared.

Findings: the memory leak is related to the WPF class WriteableBitmap which is internally used by the RadBitmap. Attached is a sample project illustrating the problem using only WPF classes.
Note: At this point, we are not aware of a possible fix.
18 comments
ADMIN
Martin Ivanov
Posted on: 04 Apr 2024 12:23

Hello Richard,

Thank you for sharing your solution.

Regards,
Martin Ivanov
Progress Telerik

A brand new ThemeBuilder course was just added to the Virtual Classroom. The training course was designed to help you get started with ThemeBuilder for styling Telerik and Kendo UI components for your applications. You can check it out at https://learn.telerik.com
Richard
Posted on: 04 Apr 2024 12:14

Apologies if this is slightly off topic but I thought I'd add some information to the issue of the ImageEditor running out of memory in case it helps anyone else experiencing memory related issues.

We had a customer that was experiencing errors when working with 4000px by 3000px images in the ImageEditor, mainly when rotating the image.

We were getting various out of memory errors and the version of the application that our customer was using was built as 32 bit x86. Setting the LARGEADDRESSAWARE on the binary fixed the problem, at least well enough for the customer to use our application in the way they wanted to.

You can enable large address awareness with the following Post Build Event in Visual Studio:

REM This command sets the LARGEADDRESSAWARE flag on the executable call "$(DevEnvDir)..\..\VC\Tools\MSVC\{msvc_version}\bin\Hostx64\x64\editbin.exe" /LARGEADDRESSAWARE "$(TargetPath)"

Not a problem if you compile for x64 but might help someone that has a legacy x86 application.

ADMIN
Martin Ivanov
Posted on: 14 Sep 2023 15:35

Hello Bhavik,

The status of this report is Won't Fix. That is because of two major factors. The first one is that there is a memory issue in the WriteableBitmap that is used internally by the RadBitmap class. The second is that the history stack of the ImageEditor is a bit limited when it comes to performance, which means that it saves the entire picture each time you make a change to it.

There is a feature request to provide a better mechanism where only the changes in the picture are stored in the history. This should minimize the memory leak caused by the WriteableBitmap.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Bhavik
Posted on: 14 Sep 2023 12:40
was this ever fixed guys?
ADMIN
Martin Ivanov
Posted on: 23 Nov 2018 15:29
Hello,

At this point we still doesn't have a resolution for the issue. The workaround suggested by Jens is the way to go. Thank you for sharing this with us, Jens.

In general you can clear the history from time to time. To do this call the Clear() method of the History object.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Jens
Posted on: 19 Nov 2018 08:06

It's two years since I worked with the control so this might not be correct anymore but anyway...

It seemed to be the cache for undo/redo that couldn't be restricted since History.Depth was bugged and didn't react on setting it. The cache just kept growing until oom problem.

I made a workaround by clearing the cache everytime image was set, and keeping ONE image cached in my own code.

p-h
Posted on: 18 Nov 2018 13:15
Is there any workaround for this problem, or should I consider using another control instead of RadImageEditor?
ADMIN
Mihail
Posted on: 17 Feb 2017 08:37
Hello Simeon,

Thank you for the suggestion. However, we are afraid that for the current purposes of RadImageEditor the usage of System.Drawing is not suitable.
Simeon
Posted on: 15 Feb 2017 16:07
What I had to do in my work around was use the System.Drawing assembly to load the image and use the imaging encoder to perform the rotation transform.  If your code did that instead I wouldn't have a problem with it. 

Better than crashing.  I could see the importing of system.drawing however would probably make your code less cross platform.
Simeon
Posted on: 15 Feb 2017 15:59
deleted by jnelson
Simeon
Posted on: 15 Feb 2017 15:56
deleted by jnelson
ADMIN
Tanya
Posted on: 14 Oct 2016 11:49
Hi Simeon,

I am sorry for the misunderstanding.

Indeed, I was able to reproduce the issue using the image you shared and it is the same as the one that this item describes. Unfortunately, we couldn't find a workaround for it. You can continue following this item in order to get notifications when the team starts working on it.

Regards,
Tanya
Simeon
Posted on: 13 Oct 2016 12:22
No sorry you misunderstood the sample WPF app hosted on Telerik.com crashes!  If you open the attached image and rotate the item 90 degrees it eventually stops rotating.  In my the code you can see a OOM exception.
Attached Files:
ADMIN
Tanya
Posted on: 13 Oct 2016 12:09
Hi Simeon,

Since you are unable to reproduce the same issue in the examples, I suggest that it might be something specific to the setup of the application. Could you open a support ticket (https://www.telerik.com/account/support-tickets) and share more information on the scenario so we can test it locally and check what is causing it?

Regards,
Tanya
simeon
Posted on: 10 Oct 2016 21:10
*WPF sample app.
simeon
Posted on: 10 Oct 2016 21:10
I am getting the same issue.  I am on a 2016 Q1 release but can recreate it on the wor sample app.
ADMIN
Tanya
Posted on: 21 Sep 2016 15:29
Hi Jens,

The item is currently not fixed. I just replied to the ticket you submitted and would like to ask you to continue the discussion on the matter there so we can gather more details about the scenario.

Regards,
Tanya
Jens
Posted on: 20 Sep 2016 13:50
Any fixes yet?