1

I have a system with 300MB of physical memory available and 6 .NET processes. Each of them can jump from 100MB in idle to 500MB in stress when resources are available. I know that system specs have to be increased but I wonder whether GC will try to collect memory more often and try to keep processes memory allocation as small as possible? Does\how GC frequency depend on system memory available?

I'm using 2.0 runtime.

Random
  • 4,519
  • 2
  • 38
  • 46
  • 1
    The GC only consumes *virtual* memory, it will always have at least 2 gigabytes available regardless of how much physical RAM the machine has installed. Which is **very** unlikely to be 300MB, that's not a quantity that you can buy from a RAM chip vendor. It is job of the operating system to make RAM available to a process, .NET has nothing whatsoever to do with it. – Hans Passant Mar 12 '14 at 10:51
  • I didn't say I have 300MB memory installed but AVAILABLE. SQL, JVM and other services take vast of 8GB installed, leaving 300MB to my processes. Each of them in IDLE is around 100MB but in stress they inflate to 500MB each if there is enough resources. – Random Mar 13 '14 at 04:35

1 Answers1

2

Garbage collection indeed depends on the system memory. It's lazy. That means it will collect less often if there is enough free space anyway.

You can read up on the details here.

The most important sentence for you:

Garbage collection occurs when one of the following conditions is true:

  • The system has low physical memory.

If you have low overall memory, there will obviously be low free physical memory more often.

Community
  • 1
  • 1
nvoigt
  • 75,013
  • 26
  • 93
  • 142