views:

39

answers:

1

I have a WPF application which doesn't seem to garbage collect on x64 systems. I have tested it carefully on x86 machines and I am confident it isn't a programming problem, the memory usage will grow and then will be garbage collected as I expect.

a) Some users access the application via terminal services on x64 Windows 2008 which is a virtual box hosted in VMWare (I think).

b) One user has a x64 physical machine running Windows 7.

A curious thing on the x86 machines is that the garbage collection also happens when I minimize the application. I can thrash the application for a while, so that it grows to say 300mb before the GC kicks in, and then click minimize and it will drop down to 20mb. Minimizing seems to trigger a garbage collection.

However, on the x64 machines (terminal or physical), the minimize trick doesn't work.

The crux of it is that we noticed the other day that one user on a) had an instance of the application with over 3gb. I have logged on the terminal machine myself, and I never see any garbage collection happening.

The application is compiled with 'Any CPU'.

A: 

The Garbage Collector runs when it decides it needs to run. This is typically a matter of the amount of memory usage as well as the amount of free memory.

If the machine(s) in question has a lot of memory, there's no reason for the GC to execute. In x86 machines, memory pressure is usually an issue, since the total allowable memory for a process is much smaller (normally 2gb), and the total for the system is low overall (~3gb). 64bit systems don't have those limitations, so the GC will likely run less often.

Remember, though, this isn't a bad thing - using memory is good, provided you don't run out. More GC collections just reduces your overall performance, and only is a good thing if your running low on available memory. Otherwise, you might as well use the memory that's available.

Reed Copsey