src/AnvilPacker/Util/Mem.cs
/// <summary> Allocates a unmanaged memory block for one <typeparamref name="T"/> element from the heap, then set it with the default <typeparamref name="T"/> value. </summary>
/// <remarks>The returned pointer should be released with <see cref="Free{T}(T*)"/> when it is no longer needed.</remarks>
Allocates a unmanaged memory block for one  element from the heap, then set it with the default  value.
Allocates a unmanaged memory block for one element from the heap then set it with the default value .
public static T* New<T>() where T : unmanaged
        {
            T* ptr = Alloc<T>(1);
            *ptr = default;
            return ptr;
        }
public static T * New < T > ( ) where T : unmanaged { T * ptr = Alloc < T > ( 1 ) ; * ptr = default ; return ptr ; }
Allocates a unmanaged memory block for one  element from the heap, then set it with the default  value.
Allocates a unmanaged memory block for one element from the heap then set it with the default value .
remarks
The returned pointer should be released with  when it is no longer needed.
The returned pointer should be released with when it is no longer needed .