Method AllocateCodeSection
AllocateCodeSection(nuint, uint, uint, LazyEncodedString)
Allocate a block of contiguous memory for use as code execution by the native code JIT engine
public abstract nuint AllocateCodeSection(nuint size, uint alignment, uint sectionId, LazyEncodedString sectionName)
Parameters
sizenuintSize of the block
alignmentuintalignment requirements of the block
sectionIduintID for the section
sectionNameLazyEncodedStringName of the section
Returns
- nuint
Address of the first byte of the allocated memory
Remarks
If the memory is allocated from the managed heap then the returned address MUST remain pinned until Dispose() is called on this allocator
important
The Execute only page setting and any other page properties is not applied to the returned address (or entire memory of the allocated section) until FinalizeMemory(out LazyEncodedString?) is called. This allows the JIT to write code into the memory area even if it is ultimately Execute-Only.