Hello,
I'm using telerik control tools for WPF UI ver: 2015.1.0401.45
I have noticed that radlistbox has a huge memory leak. On replacing radlistbox with Microsoft listbox, memory leak does not occur.
I'm attaching the demo project (replace extension of file from .jpg to .zip).
This project demonstrates the problem of memory leak. Actually the memory leak occurs on data binding
I've remarked the Microsoft listbox in xaml, so to prove my claim, just use Microsoft listbox instead of radlistbox and see the difference in memory usage of the processes.
Do you have a patch to fix this issue ?
Thank you,
Alex
5 Answers, 1 is accepted
We checked the attached project and tested the scenario using RadListBox and ListBox, however we were not able to notice any difference in the memory consumption. One thing we noticed is that you are creating UI elements and using them as ItemsSource of the ListBoxes. However in such scenarios is recommended to bind the control to data objects and use ItemTemplate in order to achieve the desired look. I have modified the attached project - please check it.
Hope this will help you.
Regards,
Kalin
Telerik by Progress
Hello Kalin,
Thank you for the answer.
First of all there is a difference with memory consumption in my demo project.
In case of radlistbox the memory usage always grows up (see attachments) and in case of listbox is not.
About using ItemTemplate, I can't use it the way you are suggesting because I have many types of srips (not one like in demo project). All strips are inheriting from interface and I can't use interface as the ItemTemplate in xaml.
Thank you,
Alex.
When you need to apply different templates depending on custom logic - you could use the ItemTemplateSelector in order to implement that logic. For more details on the data binding support of RadListBox, please check the following article:
http://docs.telerik.com/devtools/wpf/controls/radlistbox/populating-with-data/binding-support-overview
Hope this helps.
Regards,
Kalin
Telerik by Progress
Hi Kalin,
Thank you for the answer.
Your answer did not really helped me. You didn't relate to the images I've provided one post before, that shows the memory leak every time the ItemsSource is changing. The same data using Microsoft listbox doesn't have the same problem.
If you don't have a solution / fix for it , it's ok for me , but please provide me the answer.
Thank you,
Alex.
Indeed RadListBox uses more memory compared to the WPF ListBox in this scenario. However if you leave the application running for a while you would notice that the memory drops from time to time (whenever the garbage collector kicks in). I tested the app with memory profiler and actually after the garbage collection, the memory used by the removed objects is being released.
If you test the following snippet you would see the memory being release immediately the new object are created:
private
void
auto_refresh_strips_timer2_Tick(
object
sender, EventArgs e)
{
Strips = GetStrips();
GC.Collect();
GC.WaitForPendingFinalizers();
}
However we recommend using data binding in this scenario in order to achieve the best possible performance.
Hope this helps.
Regards,
Kalin
Telerik by Progress