SPACEMGR_CREATE_FREESPACE_CACHE

(Republishing, or using this info in a commercial product/website, is prohibited without permission. All other uses are permitted. If in doubt, please ask.)

(Back to main page…)

Description:

This latch is when a thread is waiting to create the free space cache for a heap IN_ROW_DATA allocation unit, or any ROW_OVERFLOW_DATA or LOB_DATA allocation unit. When inserting into a heap or a LOB structure, the insertion point is determined by where there is enough free space (as there is no forced insertion point, like there is with a new index record), based on the approximate PFS free space tracking bits for the page. Rather than having to search through PFS pages for every insert, there is a small in-memory cache of PFS free-space values for pages that is scanned before an insertion. If a page with enough free space is not found, a new page is allocated. See here for more information on the PFS bits for a page.

(Books Online description: N/A)

Questions/comments on this latch class? Click here to send Paul an email, especially if you have any information to add to this topic.

Added in SQL Server version:

2012

Removed in SQL Server version:

N/A

Extended Events latch_class value:

Maps to the SPACEMGR_CREATE_FSC map_value in sys.dm_xe_map_values.

The map_key value in sys.dm_xe_map_values is 81 in 2012 and 2014 RTM. After 2014 RTM, you must check the DMV to get the latest value as some map_key values have changed in later builds.

Other information:

I have not seen this latch be a noticeable contention point.

Known occurrences in SQL Server (list number matches call stack list):

  1. Creating the free space cache for a LOB_DATA allocation unit (in this case, when inserting a new LOB value and finding that the free space cache doesn’t already exist)

And other similar call stacks.

Abbreviated call stacks (list number matches known occurrences list):

  1. LatchBase::Suspend+170b
    LatchBase::AcquireInternal+3c9
    AllocationCaches::CreateFreeSpacePageCache+6b
    FreeSpaceScan::GetNextPageInternal+139
    CompactSpaceAllocator::FindSpaceAndFixPageFast+1d4
    CompactSpaceAllocator::FindSpaceAndFixPage+a5
    BlobBase::AllocDataNode+27b
    Blob::InsertNonFull+273
    Blob::InsertWholePage+14e
    Blob::Insert+33c
    BlobManager::ReplaceAtWithILB+6e4
    BlobManager::Copy+3d
    PrepareIlbForSetData+303
    LongRecord::PrepareNewColumns+8a0
    LongRecord::SetDataInternal+205
    LongRecord::SetData+26f
    IndexDataSetSession::SetDataInternal+9e79
    DatasetSession::SetData+123
    RowsetNewSS::SetData+44
    CMEDScanBase::FUpdateSingleRow+aa
    CMEDScan::FUpdateRow+4c7
    CMEDCatYukonObject::SetStatsBlob+2b6
    CMEDProxyStats::SetBlob+196
    CStatMan::PersistBlob+193