blob: 11049e88ebf02043a33155cd3e3fe66e122a9248 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Buffers
{
public static partial class BoundedMemory
{
private static UnixImplementation<T> AllocateWithoutDataPopulationUnix<T>(int elementCount, PoisonPagePlacement placement) where T : unmanaged
{
// On non-Windows platforms, we don't yet have support for changing the permissions of individual pages.
return new UnixImplementation<T>(elementCount);
}
private sealed class UnixImplementation<T> : BoundedMemory<T> where T : unmanaged
{
private readonly T[] _buffer;
public UnixImplementation(int elementCount)
{
_buffer = new T[elementCount];
}
public override bool IsReadonly => false;
public override Memory<T> Memory => _buffer;
public override Span<T> Span => _buffer;
public override void Dispose()
{
// no-op
}
public override void MakeReadonly()
{
// no-op
}
public override void MakeWriteable()
{
// no-op
}
}
}
}
|