We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7608b3a commit f408cb4Copy full SHA for f408cb4
src/mono/System.Private.CoreLib/src/System/Runtime/CompilerServices/RuntimeHelpers.Mono.cs
@@ -139,7 +139,13 @@ public static void RunModuleConstructor(ModuleHandle module)
139
140
public static IntPtr AllocateTypeAssociatedMemory(Type type, int size)
141
{
142
- throw new PlatformNotSupportedException();
+ if (type is not RuntimeType)
143
+ throw new ArgumentException(SR.Arg_MustBeType, nameof(type));
144
+
145
+ ArgumentOutOfRangeException.ThrowIfNegative(size);
146
147
+ // We don't support unloading; the memory will never be freed.
148
+ return (IntPtr)NativeMemory.AllocZeroed((uint)size);
149
}
150
151
[Intrinsic]
0 commit comments