Some customers have informed us about unexpected memory leaks occuring within components of Gantt Chart Library for WPF or Project Management Library for WPF in certain conditions. Most of the times the issue reports were false as the "leaks" were being caused by caching features, and other times the issues have been found underneath the controls themselves. However, we would like to explain all these situations below for any further reference:
When a developer profiles an application that references and uses our components, he or she may find out that by default, memory seems to increase over time when performing simple task movements (such as by dragging and dropping task bars within a Gantt Chart area). This is the normal behavior as by default all Schedule objects (including the built-in Schedule.Standard and Schedule.Continuous instances), referenced and used either in an explicit or an implicit manner, have their IsCachingEnabled property values set to true, as according to the original use cases that have been gathered from actual customers and recorded by our team in the early stages of the product development and also later, during the maintenance and improvement phases, many tasks would usually share much of the project timeline, and caching the working and nonworking intervals for different requests would improve overall execution performance of the target application.
If you need to preserve memory you can disable working and nonworking time interval caching by setting the Schedule.IsCachingEnabled property to false on all Schedule object instances that you use. Alternatively, let the property false, but call Schedule.ClearCache() method periodically on all Schedule object instances that you use.
If you place our components in a user interface container object within your application, and then you create and destroy multiple instances of the container type at runtime (for example, adding a Gantt Chart control in a Window and then create a new instance of the same window each time you need to show again, i.e. multiple times), you may discover that a memory leak occurs: WPF core doesn't completely dispose all memory that they use.
The issue is caused by some internal Binding objects within the default control templates (using ElementName referring visual parent naming context). Microsoft has issued their own knowledge base article regarding the topic, including some possible workarounds. Unfortunately, in the remaining cases, becuase of the the extensive customizability features that our components must offer to the developer, we are unable to apply any of the 3 workarounds from the Microsoft article (they do not apply).
However, in order to workaround the issue, you can use these simple steps, in code behind:
In other words, you should ensure that you don't use the minimum number of instances of each control type that you need in your application.
Sometimes, another way to resolve the issue is to customize the control template (you can start from a copy of our default template), trying to remove all unnecessary Binding objects in your specific case, especially checking the cases listed Microsoft's article. The default templates can be extracted from the Gantt Chart Controls Styles archive (Generic.xaml file), assuming that you use verion 4 of the product.