public void Remove () {
Interlocked.Decrement( ref handleCount);
if (handleCount < 0) {
throw new InvalidOperationException(SR.GetString(SR.InvalidOperation_HCCountOverflow));
}
int newThreshold = handleCount + handleCount/deltaPercent;
if (newThreshold < (threshold - threshold/deltaPercent)) {
lock( this) {
if (newThreshold > initialThreshold) {
threshold = newThreshold;
}
else {
threshold = initialThreshold;
}
gc_gen = 0;
}
}
for (int i = 1; i < 3; i++) {
gc_counts [i] = GC.CollectionCount (i);
}
}
}