.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Long running WPF application - Garbage Collection

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :WPF
Hi All, I have a long running WPF application; users start the application and keep it open for at least 6 hours straight. I spend a couple days with a Memory Profiler, solving a couple of memory leaks. According to the Memory Profiler, all is good now. However, when I run the application, and monitor the Memory in the Windows Task Manager, it only seems to grow. When I create a button to force the garbage collection (GC.Collect()), a lot of memory is freed from the app. My questions: 1. I don't feel like it's a good idea to call GC.Collect() explicitly; is there any case where it is advised to do so? 2. Is it normal that it takes WPF that long to start garbage collecting automatically? Thanks, Koen

View Complete Post

More Related Resource Links

ASP.NET Workflow: Web Apps That Support Long-Running Operations


Integrating workflow into ASP.NET applications means communicating with activities via a workflow queue and hosting the runtime in the global application class. We'll show you how.

Michael Kennedy

MSDN Magazine January 2009

Garbage Collection-Part 2: Automatic Memory Management in the Microsoft .NET Framework


The first part of this two-part article explained how the garbage collection algorithm works, how resources can clean up properly when the garbage collector decides to free a resource's memory, and how to force an object to clean up when it is freed. The conclusion of this series explains strong and weak object references that help to manage memory for large objects, as well as object generations and how they improve performance. In addition, the use of methods and properties for controlling garbage collection, resources for monitoring collection performance, and garbage collection for multithreaded applications are covered.

Jeffrey Richter

MSDN Magazine December 2000

Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework


Garbage collection in the Microsoft .NET common language runtime environment completely absolves the developer from tracking memory usage and knowing when to free memory. However, you'll want to understand how it works. Part 1 of this two-part article on .NET garbage collection explains how resources are allocated and managed, then gives a detailed step-by-step description of how the garbage collection algorithm works. Also discussed are the way resources can clean up properly when the garbage collector decides to free a resource's memory and how to force an object to clean up when it is freed.

Jeffrey Richter

MSDN Magazine November 2000

Video: Coding a Long-Running Operation Page in SharePoint Server 2007 or Windows SharePoint Services

Watch this visual how-to video as you learn to write code to mimic the default long-running operations page (the "spinning wheel") in SharePoint Server 2007 or Windows SharePoint Services 3.0. (Length: 7:56)

Coding a Long-Running Operation Page in SharePoint Server 2007 or Windows SharePoint Services 3.0 (V

Watch the video and explore code as you learn how to write code to mimic the default long-running operations page (the "spinning wheel") in SharePoint Server 2007 or Windows SharePoint Services 3.0.

One or more types failed to load - While creating a web application as well as running psconfig wiza



I got this error while i was trying to create a web application - 'One or more types failed to load'. So i tried to run psconfig and got the same error.

My Spec

Windows Server 2008 R2 x64

SharePoint Server 2007 x64 with MOSS SP1, MOSS SP2, WSS SP1 and WSS SP2

Microsoft Office Professional 2010 x64

Microsoft SQL Server 2005


And, here is the complete error -


Log Name:      Application
Source:        SharePoint Products and Technologies Configuration Wizard
Date:          8/27/2010 3:30:28 PM
Event ID:      104
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      ZBDEV22.zenbridge.com
Failed to register SharePoint services.
An exception of type Microsoft.SharePoint.Upgrade.SPUpgradeException was thrown.  Additional exception information: One or more types failed to load. Please refer to the upgrade log for more details.
Microsoft.SharePoint.Upgrade.SPUpgradeException: One or more types failed to load. Pleas

EventListeners and Garbage Collection


If I have a collection of objects that all have a PropertyChanged event (they implement INotifyPropertyChanged).  If I add a listener to the PropertyChanged events for all the objects in that collection, but start removing those objects will I create a memory leak, by not deattaching the listener before removing the object?  I.e. will I prevent garbage collection from happening for those objects or the listeners?

How to keep my Workflow alive only during the time my client application is running ?

Hi, I want to my workflow do some action when server  lose connection with client and at the same time client get exceptions about it. It is possible to implement some session mechanism or something like that with workflow service ? Regards Marcin

Garbage Collection

I have some understanding of Garbage collection but need some more clarifications. Which all are unmanaged and managed resources? Is database connection an unmanaged resource, if I open a database connection would I be creating an unmanaged resource. What is the difference b.w finalize and dispose. Do I have to call dispose for both managed and unmanaged resources or finalize method for umanaged resources. Setting objects = null, does that mean it clears out the memory allocated to them.   Thanks.

Workflow Runtime and Long Running Processes

I am trying to get a handle on the fact that applications have to manage the persistance of workflows directly. in 4.0.  If I set a workflow to run every night at 3:00 AM and then be persisted, how will I know that my application will be awake and ready to do the job.  I know that SharePoint currently uses a timer on the server which fires off every 5 minutes (default). 

Not Able to debug while application is running.

 Hi I am working with a Visual studio 2005 (2.0 frame work) with a windows application When I am Running the application in Debug mode and if I do some code change it is giving the following exception.   "C:\\XXX\bin\Debug\Scheduling.dll] Invalid Typeref token.     Could not load type "System.ComponentModel.Component" from assembly "Version=, CultureCould not load type "System.ComponentModel.Component" from assembly "Common, Version=, Culture=neutral, PublicKeyToken=null".=neutral, PublicKeyToken=null". 1:00:34 PM "

is there any problem if i create a site collection through programmatically which web application ha

hi all, My web application have 2  types of authentication -- for internal users (windows authentication) and external users (Form based authentication). I am creating site collections through programmatically in the web application. so this site collection should have the permission as form based authentication for external users and windows authentication for internal users. is it possible are not? please give me some suggestions on creating site collections which have form based authentication and windows authentication. thanks in advance......

Page cannot be found error on clearing cookies while running application

Hello all,            I've a web application which is running on sql state session .. And is running well under normal conditions. But when my application is in home page or landing page after loging to the application, if user clears all his history and cookies and click on any menu in the application . It is giving  Internet Explorer cannot display the webpage error.. I'm not able to debug the error.. am getting the same problem even under deploying conditions. How to handle this issue?   Thanks in advance, Hari.

The application domain in which the thread was running has been unloaded

Recently upgraded to VS 2005. With a large project, I keep getting this message when I try and build.Looked through the forums - have tried cleaning and rebuilding - no joy.Have also tried increasing size of virtual memory - no joy.Any ideas?Thanks   

WPF Web application is not running

Hi,   I am new to WPF and using VSTS 2008. I created WPF web application . When I click on Run button, it is showing, choose program dialog box. This usally comes when some software are not installed. Please advice why it is coming when I am running WPF web application. Thanks bpoola
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend