Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy the NativeAOT AllocateTypeAssociatedMemory to Mono #99072

Merged
merged 4 commits into from
Feb 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ public static void RunModuleConstructor(ModuleHandle module)

public static IntPtr AllocateTypeAssociatedMemory(Type type, int size)
{
throw new PlatformNotSupportedException();
if (type is not RuntimeType)
throw new ArgumentException(SR.Arg_MustBeType, nameof(type));

ArgumentOutOfRangeException.ThrowIfNegative(size);

// We don't support unloading; the memory will never be freed.
return (IntPtr)NativeMemory.AllocZeroed((uint)size);
}

[Intrinsic]
Expand Down