Monitoring Garbage Collector in C#

I don’t see GC.RegisterForFullGCNotification(int,int) anywhere in your code. It looks like you’re using the WaitForFullGC[xxx] methods, but are never registering for the notification. That’s probably why you’re getting the NotApplicable status. However, I’m doubting that GC is your problem, while possible, I suppose it would be good to know about all of the GC modes … Read more

Empty an ArrayList or just create a new one and let the old one be garbage collected? [duplicate]

The advantage of recycling an ArrayList (e.g. by calling clear) is that you avoid the overhead of allocating a new one, and the cost of growing it … if you didn’t provide a good initialCapacity hint. The disadvantages of recycling an ArrayList include the following: The clear() method has to assign null to each (used) … Read more

Javascript and Garbage collection

Javascript doesn’t have explicit memory management, it’s the browser which decides when to clean it up. Sometimes it may happen that you experience un-smooth rendering of JavaScript due to a garbage collection pause. There are many techniques that you can apply to overcome glitches caused by garbage collection (GC). More you apply more you explore. … Read more

What’s the best way (most efficient) to turn all the keys of an object to lower case?

The fastest I come up with is if you create a new object: var key, keys = Object.keys(obj); var n = keys.length; var newobj={} while (n–) { key = keys[n]; newobj[key.toLowerCase()] = obj[key]; } I’m not familiar enough with the current inner working of v8 to give you a definitive answer. A few years ago … Read more

GC.Collect()

I can see that several people have gone extreme about not recommending to call GC.Collect. GC.Collect is there for a reason, here are my recommendation of when and why to call GC.Collect. In General, don’t worry about calling it, GC tunes itself very well and will do the right thing. Sometimes, you end up in … Read more