/// <summary>
        /// Deletes this object.
        /// <para>
        /// This function must be used instead of destructor, which is private.
        /// There is no reference counting involved.
        /// </para>
        /// </summary>
        private void ReleaseThis()
        {
            using var debugGlobalMutexLock = D3D12MA_DEBUG_GLOBAL_MUTEX_LOCK();

            // Copy is needed because otherwise we would call destructor and invalidate the structure with callbacks before using it to free memory.
            D3D12MA_ALLOCATION_CALLBACKS allocationCallbacksCopy = *GetAllocs();

            D3D12MA_DELETE(&allocationCallbacksCopy, ref this);
        }
        public D3D12MA_JsonWriter([NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] ref D3D12MA_ALLOCATION_CALLBACKS allocationCallbacks, [NativeTypeName("StringBuilder&")] D3D12MA_StringBuilder *stringBuilder)
        {
            m_SB = stringBuilder;

            Unsafe.SkipInit(out m_Stack);
            D3D12MA_Vector <StackItem> ._ctor(ref m_Stack, (D3D12MA_ALLOCATION_CALLBACKS *)Unsafe.AsPointer(ref allocationCallbacks));

            m_InsideString = false;
        }
 internal static T *AllocateArray <T>([NativeTypeName("const ALLOCATION_CALLBACKS&")] ref D3D12MA_ALLOCATION_CALLBACKS allocs, [NativeTypeName("size_t")] nuint count)
     where T : unmanaged
 {
     return((T *)Malloc((D3D12MA_ALLOCATION_CALLBACKS *)Unsafe.AsPointer(ref allocs), (nuint)sizeof(T) * count, __alignof <T>()));
 }
 internal static void Free([NativeTypeName("const ALLOCATION_CALLBACKS&")] ref D3D12MA_ALLOCATION_CALLBACKS allocs, void *memory)
 {
     allocs.pFree(memory, allocs.pUserData);
 }
 public static void _ctor(ref D3D12MA_AllocationObjectAllocator pThis, [NativeTypeName("const D3D12MA_ALLOCATION_CALLBACKS&")] ref D3D12MA_ALLOCATION_CALLBACKS allocationCallbacks)
 {
     D3D12MA_MUTEX._ctor(ref pThis.m_Mutex);
     D3D12MA_PoolAllocator <D3D12MA_Allocation> ._ctor(ref pThis.m_Allocator, (D3D12MA_ALLOCATION_CALLBACKS *)Unsafe.AsPointer(ref allocationCallbacks), 1024);
 }
 public D3D12MA_StringBuilder(ref D3D12MA_ALLOCATION_CALLBACKS allocationCallbacks)
 {
     Unsafe.SkipInit(out m_Data);
     D3D12MA_Vector <ushort> ._ctor(ref m_Data, (D3D12MA_ALLOCATION_CALLBACKS *)Unsafe.AsPointer(ref allocationCallbacks));
 }