This is a migrated thread and some comments may be shown as answers.

Memory leak after scheduler refresh

2 Answers 87 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Dejo Savicevic
Top achievements
Rank 1
Dejo Savicevic asked on 04 Nov 2010, 01:10 PM
Hi

I have scheduler with resources showed in timeline view. Every 5 second scheduler is refreshed (check if there is any changes in scheduler data source). After that, for some reason, resources lose their color (became gray), so they need to be repainted, like this:

For Each res As Resource In RadScheduler1.Resources
    res.Color = Color.Aquamarine
Next
 
To ensure that resources are repainted, I need to call this part of code:
Dim schtimelineGrouping As TimelineGroupingByResourcesElement = TryCast(RadScheduler1.SchedulerElement.ViewElement, TimelineGroupingByResourcesElement)
schtimelineGrouping.RefreshViews(True)
schtimelineGrouping = Nothing

And it seems that this procedure RefreshViews make a problem with memory leak.
 
To be sure, I created a test application which every 5 second execute only coloring and refreshing of scheduler resources, for example:
For Each res As Resource In RadScheduler1.Resources
    res.Color = Color.Aquamarine
Next
     
Dim schtimelineGrouping As TimelineGroupingByResourcesElement = TryCast(RadScheduler1.SchedulerElement.ViewElement, TimelineGroupingByResourcesElement)
schtimelineGrouping.RefreshViews(True)
schtimelineGrouping = Nothing
In a short period of time (1 hour) application increased memory usage from 44MB to over 100MB.

In a real application memory usage growth to more than 1.5GB, and than Out of Memory exception occurred. For a testing purposes application was working almost for a 24 hours. 
 
Is this a good approach of resource coloring, and how this can be fixed?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Dobry Zranchev
Telerik team
answered on 12 Nov 2010, 04:02 PM
Hi Dejo,

Thank for reporting the issue and please accept my apologies for the delayed response.

I was able to reproduce the issue and I updated your Telerik points accordingly. You could avoid calling the RefreshView(true) by using the following approach:
TimelineGroupingByResourcesElement viewElement = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement;
 
foreach (RadElement element in viewElement.ResourcesHeader.Children)
{
    SchedulerCellElement cell = element as SchedulerCellElement;
    if (cell != null)
    {
        cell.BackColor = Color.Pink;
        cell.GradientStyle = GradientStyles.Solid;
    }
}
foreach (Resource res in this.radScheduler1.Resources)
{
    res.Color = Color.Pink;
}

With the help of this code snippet you can change the color of the header element directly instead of re-created the view. In addition, this is not a time consuming operations.

I hope this helps. If you need additional assistance, feel free to contact us.

Sincerely yours,
Dobry Zranchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Dejo Savicevic
Top achievements
Rank 1
answered on 15 Nov 2010, 04:50 PM
Hi Dobry,

Thank you, this was helpful.
Tags
Scheduler and Reminder
Asked by
Dejo Savicevic
Top achievements
Rank 1
Answers by
Dobry Zranchev
Telerik team
Dejo Savicevic
Top achievements
Rank 1
Share this question
or