in ProfilingAPI/ReJITEnterLeaveHooks/ILRewriter.cpp [695:711]
LPBYTE AllocateILMemory(unsigned size)
{
if (m_pICorProfilerFunctionControl != NULL)
{
// We're supplying IL for a rejit, so we can just allocate from
// the heap
return new BYTE[size];
}
// Else, this is "classic-style" instrumentation on first JIT, and
// need to use the CLR's IL allocator
if (FAILED(m_pICorProfilerInfo->GetILFunctionBodyAllocator(m_moduleId, &m_pIMethodMalloc)))
return NULL;
return (LPBYTE)m_pIMethodMalloc->Alloc(size);
}