■
Rule
If the managed heap does not have sufficient memory to allocate a requested object, a garbage collection
will occur.
When a collection does take place, the garbage collector temporarily suspends all active
threads within the current process to ensure that the application does not access the heap during
the collection process. We will examine the topic of threads in Chapter 18; however, for the time
being, simply regard a thread as a path of execution within a running executable. Once the garbage
collection cycle has completed, the suspended threads are permitted to carry on their work. Thank-
fully, the .NET garbage collector is highly optimized; you will seldom (if ever) notice this brief
interruption in your application.
Do'stlaringiz bilan baham: |