Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Sustained Low-Latency Garbage Collection for .NET 4.0

Sustained Low-Latency Garbage Collection for .NET 4.0

This item in japanese

While most of the attention has been on the upcoming .NET 4.5, Microsoft is continuing to make minor enhancements to .NET 4.0. The newest release, .NET 4.0.3, includes changes to garbage collection, Windows Workflows, and more. This version is not enabled by default; developers wishing to use the new features need to specifically reference either “.NET Framework 4.0.3” or “.NET Framework 4.0.3 Client Profile” in the Target framework option for their project.

Garbage Collection

The .NET allows developers to alter the latency mode of the garbage collector. Normally the latency mode is set to Batch for high throughput applications that can tolerate brief interruptions while a full garbage collection cycle runs. An example of this would be a web site where the GC-based interruption would be no more noticeable than normal network latency. For applications with a user interface, Interactive mode is used instead. This is slower than Batch mode, but is more likely to run concurrently in a fashion that doesn’t reduce UI responsiveness.

Some applications needs a combination of high throughput and low latency. In .NET 2.0 SP 1, these applications had the ability to switch to LowLatency mode for brief periods of time. This mode all but eliminated GC pauses, but could only be used for brief periods of time without risking an out-of-memory exception unless a full GC cycle is manually triggered from time to time.

The new SustainedLowLatency mode offers a compromise between the LowLatency and Interactive modes. While still highly tuned for avoiding GC pauses, it will allow a full blocking garbage collection to occur is absolutely necessary. This makes it safer to leave in this mode for long periods of time, but developers are still warned to avoid unnecessary memory allocations while in a low latency mode.

Windows Workflow Foundation

The core engine for Windows Workflow Foundation can now be run in partially trusted environments. Most features are supported except SqlWorkflowInstanceStore and Visual Basic expression. The latter two continue to be usable only in a full trust environment.

Portable Class Libraries

Portable class libraries now include the System.Xml.Linq and System.ComponentModel.DataAnnotations libraries.

SQL Server - Correlated Connection ID

In Microsoft SQL Server 2012, capability to correlate a connection ID between the client and the server is added. With this update SqlClient will send the connection ID information so that it can be logged on the server side. Additionally, the following capabilities are added to SqlClient to provide ways to retrieve the connection ID on the client side if it is available:

  • ConnectionId property on SqlConnection
  • ConnectionId property on SqlException
  • SqlException.ToString will include the connection ID

Rate this Article