In my ASP.NET app, I have a dictionary that contains a large number of objects (let's say as large as 1M, could get even bigger later), the object stored in the dictionary is of reference type not struct type, the dictionary is meant to work as a cache for this type of objects (I have my reasons not to use the ASP.NET cache for caching this type of object, I use it for caching other things though).
Can this cause problems with the GC? I keep hearing that long living objects affect the performance of the GC and cause it to take more time during collecting, is there anyway to avoid this? As far as I understand the dictionary (and the objects) should end up in Gen2 which the GC doesn't collect unless the system is low in memory (please correct me if I'm wrong), so what if the system has a lot of memory, will the GC still collect Gen2 with the same frequency? There must be other applications that cache large amounts of data for a long time too, I wonder how they avoid the problems with the GC.
Any suggestion are really appreciated ...