@@ -19,6 +19,7 @@ namespace UnmanagedMemoryUtils
1919 /// </summary>
2020 /// <param name="length">The length of the memory range.</param>
2121 /// <returns>The unmanaged memory that points to the newly allocated memory.</returns>
22+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
2223 public static ReadOnlyUnmanagedMemory AllocateFromHGlobal ( int length )
2324 {
2425 return new ReadOnlyUnmanagedMemory ( Marshal . AllocHGlobal ( length ) , length ) ;
@@ -29,6 +30,7 @@ public static ReadOnlyUnmanagedMemory AllocateFromHGlobal(int length)
2930 /// </summary>
3031 /// <param name="length">The length of the memory range.</param>
3132 /// <returns>The unmanaged memory that points to the newly allocated memory.</returns>
33+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
3234 public static ReadOnlyUnmanagedMemory AllocateFromCoTaskMem ( int length )
3335 {
3436 return new ReadOnlyUnmanagedMemory ( Marshal . AllocCoTaskMem ( length ) , length ) ;
@@ -311,6 +313,7 @@ public override readonly int GetHashCode()
311313 /// </summary>
312314 /// <param name="length">The amount of items to store in this memory.</param>
313315 /// <returns>The unmanaged memory that points to the newly allocated memory.</returns>
316+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
314317 public static ReadOnlyUnmanagedMemory < T > AllocateFromHGlobal ( int length )
315318 {
316319 return new ReadOnlyUnmanagedMemory < T > ( Marshal . AllocHGlobal ( length * TypeSize ) , length ) ;
@@ -321,6 +324,7 @@ public static ReadOnlyUnmanagedMemory<T> AllocateFromHGlobal(int length)
321324 /// </summary>
322325 /// <param name="length">The amount of items to store in this memory.</param>
323326 /// <returns>The unmanaged memory that points to the newly allocated memory.</returns>
327+ [ MethodImpl ( MethodImplOptions . AggressiveInlining ) ]
324328 public static ReadOnlyUnmanagedMemory < T > AllocateFromCoTaskMem ( int length )
325329 {
326330 return new ReadOnlyUnmanagedMemory < T > ( Marshal . AllocCoTaskMem ( length * TypeSize ) , length ) ;
0 commit comments