MEMORY_ALLOCATION_EXT

(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 wait type is when a thread is switching to preemptive mode while allocating memory. The preemptive switch is so that the code being executed does not have to check for quantum exhaustion.

(Books Online description: N/A)

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

Added in SQL Server version:

2016

Removed in SQL Server version:

N/A

Extended Events wait_type value:

The map_key value in sys.dm_xe_map_values is 1100 in 2016 RTM. After 2016 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 wait type be a noticeable contention point, but this post explains a case where it seems to be a bottleneck when using the HASHBYTES functionality that was introduced in SQL Server 2017.

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

  1. Allocating memory (in this case, while running the background FILESTREAM garbage collector)
  2. Allocating memory (in this case, while creating a new page to hold a blob value)
  3. Allocating memory (in this case, while creating a new page as part of a page split operation)
  4. Allocating memory (in this case, while pulling data from the MDW collection set table snapshots.performance_counter_value

And many more similar call stacks.

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

  1. SOS_Task::PopWait+0xb4
    MemoryClerkInternal::AllocatePagesWithFailureMode+0x18c
    MemoryClerkInternal::AllocatePages+0x2b
    CMemThread<CMemObj>::PbGetNewPages+0x63
    TVarPageMgr<0>::PviNewVarPage+0x36
    TVarPageMgr<0>::PbAllocate+0x1dd
    CMemThread<CMemObj>::Alloc+0xa8
    SetFilter+0x5bd
    IndexDataSetSession::SetFilterInternal+0x6e
    RowsetNewSS::SetFilter+0x2f0
    CMEDScan::StartSearch+0x492
    CMIterObjects::StartIteration+0x2b1
    FsTombstoneTableAccessor::Open+0xe2
    FsGarbageCollector::CollectGarbageIteration+0x23a
    FsGarbageCollector::CollectGarbage+0x128
    FsGarbageCollector::ProcessFsGarbageCollectionForDB+0x381
    FsGarbageCollector::ProcessFsGarbageCollection+0x22f
    PeriodicTimerTask::ProcessTskPkt+0x79
    TaskReqPktTimer::ExecuteTask+0x69
    OnDemandTaskContext::ProcessTskPkt+0x31f
    SystemTaskEntryPoint+0x3d2
    OnDemandTaskContext::FuncEntryPoint+0x25
  2. SOS_Task::PopWait+0xb4
    MemoryClerkInternal::AllocatePagesWithFailureMode+0x18c
    MemoryClerkInternal::AllocatePages+0x22
    BPool::Steal+0x52b
    BPool::NewPage+0x661
    PageRef::FormatInternal+0x83
    CompactSpaceAllocator::AllocateAndFixPage+0x4b9
    CompactSpaceAllocator::AllocateAndFixPageInternal+0xb1
    CompactSpaceAllocator::FindSpaceAndFixPage+0x144
    BlobBase::AllocDataNode+0x284
    Blob::InsertNonFull+0x2e4
    Blob::InsertWholePage+0x159
    Blob::Insert+0x236
    BlobManager::ReplaceAtWithILB+0x59b
    LockBytesSS::ReplaceAtWithILB+0x17
    CMainIlb::ReplaceAtWithILB+0x90
    CBlobHandleFactories::CopyIlbRaiseError+0x70
    CBlobHandleHelper::CopyBlobHandleIntoTempOrInlined+0x1ff
    CBlobHandleManagerCommon::PxvarPreprocessInternal+0x11b
    CValRowNoHrow::SetDataX+0x28
    CEsExec::FastMoveEval+0x160
    CQScanSortNew::PushRow+0x2e
  3. SOS_Task::PopWait+0xb4
    MemoryClerkInternal::AllocatePagesWithFailureMode+0x18c
    MemoryClerkInternal::AllocatePages+0x22
    BPool::Steal+0x52b
    BPool::NewPage+0x661
    PageRef::SetupPageHeaderPreAllocation+0x65
    SetupPageHeaderPreAllocation+0x6c
    TargetExtentMgr::AllocPageFromTargetExtent+0x5e4
    AllocationReq::AllocateFromExistingExtents+0xa39
    AllocationReq::AllocatePages+0xdac
    AllocationReq::Allocate+0xf3
    AllocateHoBtDataPage+0x5e8
    IndexPageManager::AllocatePage+0x1ad
    SplitPage+0x8d8
    IndexDataSetSession::InsertSmallRecord+0x1b09
    IndexDataSetSession::InsertRowInternal+0x20dc
    DatasetSession::InsertRow+0x2de
    RowsetNewSS::InsertRow+0x26
    CBlobHandleFactoryMain::CreateNewBlobHandleInternal+0x1e7
    CBlobHandleFactoryMain::CreateNewBlobHandle+0x88
    CBlobHandleHelper::CopyBlobHandleIntoTempOrInlined+0x1d3
    CBlobHandleManagerCommon::PxvarPreprocessInternal+0x11b
  4. SOS_Task::PopWait+0xba
    MemoryClerkInternal::AllocatePagesWithFailureMode+0x177
    MemoryClerkInternal::AllocatePages+0x28
    CCacheStoreWrappingPageAllocator::AllocatePages+0x32
    MemoryObjectFactory::CreateMemObjectInt+0x76
    MemoryObjectFactory::CreateMemObject+0xe2
    TCacheStore<CacheClockAlgorithm>::CreateMemoryObject+0x131
    CSQLSource::PmoCreateLargeCPMemObj+0x5d
    CSQLSource::CreateMsqlExecContext+0x42
    CSQLSource::Transform+0x81e
    CSQLSource::Execute+0x47f
    process_request+0xe52
    process_commands_internal+0x289
    process_messages+0x213
    SOS_Task::Param::Execute+0x231
    SOS_Scheduler::RunTask+0xad
    SOS_Scheduler::ProcessTasks+0x3cd