Garbage Collection

Jun 13, 2008 at 2:48 PM
Hello, was wondering if there was anything being done about Garbage Collection w/in the cache implementation.  The concern is that with the cache storing all this information, that many of the objects will eventually make it to gen 2 whereby when they expire, a large amount will need to be collected down the road which could eventually lock the entire node for several seconds.  For systems that must handle multiple simultaneous requests (e.g. Web), this could present some intolerable delays.

Thanks
Coordinator
Jun 22, 2008 at 7:14 AM
Hi Matt,

thanks for your post. We have done several tests to take control over Garbage Collection and finished up with the following 2 things:

 - Upon deletet of an item we use after lockdown of the cache: GC.WaitForPendingFinalizers(); (Cache.cs line 274)
 - Upon clear command we use after lockdown: GC.Collect(); (Cache.cs line 293)

Any suggestion is modern welcome.

regards,
roni
Coordinator
Jun 22, 2008 at 8:47 AM
Edited Jun 22, 2008 at 8:49 AM
Update:

since I call GC.WaitForPendingFinalizers() and GC.Collect()  upen Remove and Clear within the files CacheExpire.cs & CacheCleanup.cs I get all RAM free - it happens immediately.

You can test this behavior with the next checkin or you can have a look at the following issue tracker item: [workitem:6154]

i have added there a printscreen: http://www.codeplex.com/SharedCache/WorkItem/AttachmentDownload.ashx?WorkItemId=6154&FileAttachmentId=1584