Coffeehouse Post

Single Post Permalink

View Thread: Patrick Dussud interview next week: Questions?
  • User profile image
    DoomBringer

    Minh wrote:
    

    Littleguru wrote:
    - Why isn't it possible to force the GC to do a collect. I mean GC.Collect() just signalizes that a collect is required, but the GC could decide to do not. Why has this been implemented in that way?


    If this is indeed true, can't we have a GC.Collect(bool meanIt); ?


    Probably because the GC knows more about current memory than the developer does 99% of the time.  Forcing a GC when there are only a few dozen objects that need cleaning up is a bad idea.  GC collection is a high overhead operation and calling it arbitrarily is bad practice nearly all of the time.