ForceGarbageCollection |
PROPERTY - Read / Write Parent Object - HL7Vendor Name: ForceGarbageCollection Data Type: Boolean (Default TRUE) Description: Get / Set the ForceGarbageCollection boolean property.
Further: When creating HL7 applications using the EasyHL7 Managed Code objects it is a pretty common scenario to reuse objects iteratively. This is particularly true when processing large batches of HL7 messages (see the example below). If the ForceGarbageCollection property is TRUE (it's default value) the HL7Vendor Object will periodically (if needed) suspend the current thread to allow the .Net Framework Garbage Collector to empty it's queue by calling the WaitForPendingFinalizers() method of the .Net GC object. It will also force a complete garbage collection whenever the Refresh() method is called and when the object is destroyed and it's finalizer is invoked by regular .Net Framework garbage collection. You can override all of this behavior by setting the ForceGarbageCollection property to False.
Why is this necessary? At the time of this writing (January 2009) there is a little known bug in the .Net Framework Garbage Collecting subsystem which affects systems running more than 2 GB RAM (and typically Windows Server 2003 or greater, both 32 and 64 bit versions) which can cause a NULL memory exception to be thrown IN ERROR when the GC memory heap reaches a certain size. Basically what happens is that the GC queries the system for available memory to use for discarded objects and is told there is plenty of memory available (which is true) but then throws the error when it tries to allocate memory on the GC heap.
|