We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Chart not released ?

Hello,

I have an application that use use homemade MDI windows system and is hosted in xbap. MDI child are usercontrol and when i close my MDI child, the usercontrol is no more referenced.
Now when i create a chart (just the chart without datasource) inside MDI Child and then i close the MDI child, my usercontrol is still referenced by the chart.
I used Memory Profiler to watch if a suspect event could be the reason and actually there is an event referencing Chart wich is never released.

Here is what i have :

Namespace Name
Syncfusion.Windows.Chart Chart
^
|
| referenced by
|
|
Namespace Name
System EventHandler #257,306._target

The allocation stack is showing for this EventHandler :
Chart.RegisterEventForClose()
Chart.Chart_Loaded(object, RoutedEventArgs)
RoutedEventHandlerInfo.InvokeHandler(object, RoutedEventArgs)
RouteItem.InvokeHandler(RoutedEventArgs)
....

It seems that Chart.RegisterEventForClose() eventhandler is created in Loaded method of chart.

Now i use Reflector to find out what it means :
//
private void RegisterEventForClose()

{
Window window = (Window) VisualUtils.FindSomeParent(this, typeof(Window));
if (window != null)
{
window.Closed += new EventHandler(this.OnApplicationClosed);
}
else
{
Page page = (Page) VisualUtils.FindSomeParent(this, typeof(Page));
if (page != null)
{
page.Unloaded += new RoutedEventHandler(this.OnApplicationClosed);
}
}
}
//

Okay for me that means that an Chart.OnApplicationClosed will be fired on the Unloaded of the Page control (in my case because i use XBAP)

Now let's see Chart.OnApplicationClosed :

//
private void OnApplicationClosed(object sender, EventArgs e)
{
if (this.propertyItem != null)
{
this.isChartClose = true;
this.propertyItem.Close();
}
}
//
It seems that OnApplicationsClosed is necessary to clean Chart and release it (?)


The problem seems to be in RegisterEventForClose() : my whole XBAP application is hosted in a Page. The Page is never quited until i close application. So OnApplicationClosed is never fired until i close the application. That means all charts remain unfortunately in memory during the lifetime of the application.


1) Could you confirm what i describe ?
2) Could you suggest an implementation or a workaround to release Charts on unload of my usercontrol?

Best regards,
FMO

12 Replies

PI Poorani Idhaya Bala M.A Syncfusion Team September 24, 2009 01:12 PM UTC

Hi,

Thank you for your interest in Syncfusion products.

We got your requirement,We are working on this and will get you an update soon.

Thanks,
Poorani


FM Frederic Mory October 6, 2009 11:33 AM UTC

Hello,

Any news about this issue ?

I hope at least a fix will be included in next release, we really need it for our application in production environment.

Regards,
FMO


PI Poorani Idhaya Bala M.A Syncfusion Team October 7, 2009 07:07 AM UTC


Hi,

Thanks for your patience.

Sorry for the delaying update. We are glad to inform you that the issue which “Chart not released” has been fixed and it will include in our vol4 release which is Scheduled on October 22.

Thanks for choosing Syncfusion Products.

Please let us know if you have any other further queries.

Thanks,
Poorani


FM Frederic Mory October 8, 2009 06:50 AM UTC

Very good thing !

Thanks for your support.

Regards,
FMO


PI Poorani Idhaya Bala M.A Syncfusion Team October 8, 2009 10:57 AM UTC

Hi,

Thank you. We will update you once our product is released.

Thanks for choosing Syncfusion Products.

Thanks,
Poorani


PI Poorani Idhaya Bala M.A Syncfusion Team October 12, 2009 11:51 AM UTC

Hi,

Thanks for choosing Syncfusion Products.

If you need assemblies with this fix, kindly create new incident in our direct-trac system so that we can update you with custom assemblies with this fix. Also We have noticed you've submitted a number of specific technical inquiries here in the Forums which seem to indicate you are a current customer rather than an evaluator or tester. If so, you might like to know that you have an existing personal Direct-Trac account available using your own email address, and we highly recommend using your personal account. You'll get a faster response along with an automatic update when your question is answered via DirectTrac, and you can login and view your incident history 24x7.

Simply visit
https://www.syncfusion.com/Support/DirectTrac/logon.aspx?URL=/Support/DirectTrac/default.aspx to login.

If you have any further questions, we hope you will take advantage of your existing account and available services as a license holder.

Please let us know if you have any questions.

Thanks,
Poorani


FM Frederic Mory October 12, 2009 02:28 PM UTC

Hi,

You should receive a new ticket in a moment by our developer (i'm not ;)) on Direct Track.

Regards,
FMO


PI Poorani Idhaya Bala M.A Syncfusion Team October 13, 2009 05:12 AM UTC

Hi,

Thanks for opening Direct Trac account. We have updated the custom assemblies in Direct Trac.

Let us know if you have any questions.

Thanks for choosing Syncfusion Products.

Thanks,
Poorani



FM Frederic Mory October 13, 2009 07:29 AM UTC

Hello,

Charts are now well released when my UserControl dont reference them anymore.

Thank you for your Premium support !

Regards,
FMO


PI Poorani Idhaya Bala M.A Syncfusion Team October 14, 2009 09:37 AM UTC

Hi,

Thanks for choosing Syncfusion products.

We are glad to hear that your problem has been resolved. Please do not hesitate to contact us if you ever need further assistance from us.

Please let us know if you have any queries.

Thanks,
Poorani


BF Bouchind'homme Franck December 21, 2012 02:52 PM UTC

I'm evaluating the WPF Essential Chart and looks like that the chart is not released either.
 
On different vendor product i :
- Instanciate a chart class
- Add the chart to the visual
- Create on it some serie
- Remove it from the visual
- nullates the reference
- call GC.collect()
 
And Syncfusion is the only one not releasing its data, and Syncfusion consumes a lot of it.
 
What should i do to severe any reference to the chart so GC can free it ?
 
I tryed MemProfiler and CLRProfiler to figure out but no luck :
- When my chart is instanciated CLRPRofiler shows my class member reference pointing to it
- When i remove it form visual and put my class member reference to null it looks like that some Generic Dictionnary is now referencing the Chart.ChartArea and prevent freeing the chart
 
My application is a simple base WPF one and joined to the post.


EvaluationGrapheur.Syncfusion_9ce8695.zip


MP Michael Prabhu M Syncfusion Team December 24, 2012 10:46 AM UTC

Hi,

Thanks for using Syncfusion Products,

We have analyzed your sample and we like to inform you that there is a property called "DisposeOnUnload" in Chart which has to be set to true in order to clear the memory leak. We have modified the sample as per your requirement and it can be downloaded from the link below.

If you still face the problem can you please open a Direct Track incident along with the version details of the Chart so that we can provide patch accordingly.

Please let us know if you need further clarifications.

Thanks,

Michael Prabhu.



EvaluationGrapheur.Syncfusion_2502521e.zip

Loader.
Live Chat Icon For mobile
Up arrow icon