FIX: Excessive memory usage when you trace RPC events that involve Table-Valued Parameters in SQL Server 2016 and 2017

Applies to: SQL Server 2017 DeveloperSQL Server 2017 EnterpriseSQL Server 2017 Enterprise Core More

Symptoms


Consider the following scenario:

  • You have SQL Server 2016 and 2017 installed.

  • You use rpc_starting, rpc_completed, RPC:Starting, RPC:Completed, or Audit Schema Object Access SQL Server Extended Events or SQL Server Profiler to trace RPC events.

  • You use a remote procedure call that contains table-valued parameters (TVP) that have many rows.

In this scenario, excessive memory usage may occur, and server performance may decrease. If you query the sys.dm_os_memory_clerks DMV, you notice that the OBJECTSTORE_LBSS clerk has many memory allocations compared to when there is no ongoing RPC trace collection.

Resolution


This problem is fixed in the following updates for SQL Server:

          Cumulative Update 13 for SQL Server 2017

Cumulative Update 12 for SQL Server 2017

Cumulative Update 4 for SQL Server 2016 SP2

Note 

  • After this update is applied, the fix limits the number of traced rows for TVP in each event. This means that some traced event may not contain all rows in TVP.
  • For another fix in which SQL Server Out of memory issue when TVP are captured is fixed, please refer to KB 4051359.

Status


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References


Learn about the standard terminology Microsoft uses to describe software updates.