Remove byte* property in ByteBufferAllocator (#5191)
authorEric Erhardt <eric.erhardt@microsoft.com>
Thu, 21 Feb 2019 22:36:55 +0000 (16:36 -0600)
committerWouter van Oortmerssen <aardappel@gmail.com>
Thu, 21 Feb 2019 22:36:55 +0000 (23:36 +0100)
commit0cdacdfb354bec1832bb525e1394754debbf6195
tree4f7525982deb7370681b52101fb162228536a693
parentbb58442054adbc502e54df0ce31516927da0b715
Remove byte* property in ByteBufferAllocator (#5191)

* Remove byte* property in ByteBufferAllocator.

This allows consumers to read/write into native memory, but without
having to always pin the managed `byte[]` when working with managed
memory. This allows for users to not need to Dispose() ByteBuffers
when they are using the default ByteArrayAllocator class.

Instead, we use `Span<byte> GetSpan()` methods to get access to the
underlying memory buffer.

Fix #5181

* Add a set of benchmark tests.

* Add ReadOnly spans.

This allows consumers to use ReadOnlyMemory<byte> as the backing storage
for ByteBuffers, which is useful in read-only scenarios.

* Run tests using ENABLE_SPAN_T in appveyor.

* Fix FlatBuffers.Test.csproj to work on older MSBuild versions.

* Change the test script to test UNSAFE_BYTEBUFFER

* Address PR feedback.

Remove IDisposable from ByteBuffer.

* Respond to PR feedback.
appveyor.yml
net/FlatBuffers/ByteBuffer.cs
tests/FlatBuffers.Benchmarks/FlatBufferBuilderBenchmark.cs [new file with mode: 0644]
tests/FlatBuffers.Benchmarks/FlatBuffers.Benchmarks.csproj [new file with mode: 0644]
tests/FlatBuffers.Benchmarks/Program.cs [new file with mode: 0644]
tests/FlatBuffers.Test/FlatBuffers.Test.csproj