Several
of the SharePoint Foundation objects, primarily the SPSite
class and SPWeb
class objects, are created as managed objects. However, these objects use
unmanaged code and memory to perform the majority of their work. The managed
part of the object is much smaller than the unmanaged part. Because the smaller
managed part does not put memory pressure on the garbage collector, the garbage
collector does not release the object from memory in a timely manner. The
object's use of a large amount of unmanaged memory can cause some of the
unusual behaviors described earlier. Calling applications that work with IDisposable
objects in SharePoint Foundation must dispose the objects when the applications
finish using them. You should not rely on the garbage collector to release them
from memory automatically.
Each
instance of SPSite and SPWeb contains a reference to an SPRequest object that,
in turn, contains a reference to an unmanaged COM object that handles
communications with the database server. SharePoint Foundation monitors the
number of SPRequest objects that exist in each specific thread and in parallel
threads, and adds useful entries to the logs under the three following
scenarios:
- The total number of SPRequest objects exceeds a configurable threshold.
- An SPRequest object continues to exist at the end of a thread.
- An SPRequest object was removed from the heap by garbage collection
No comments:
Post a Comment