Highly Performant & Scalable Ultima Online Server Emulator https://www.modernuo.com
Find a file
Kamron Batman 582e1877b8
feat(core): Makes spanwriter resizable (#376)
SpanWriter now has an argument that allows it to be resizable.
```cs
public SpanWriter(Span<byte> initialBuffer, bool resize = false)
public SpanWriter(int initialCapacity, bool resize = false)
```

If a SpanWriter is set to be resizable, or given an initial capacity instead of a buffer, it must be disposed:
```cs
public static void SomeMethod()
{
    using var writer = new SpanWriter(stackalloc byte[512], true);
    // stuff
    
    // Automatic Dispose of writer
}
```

This is because the SpanWriter uses `ArrayPool<byte>.Shared` _rented buffers_ to resize. If the writer is not disposed, those buffers will never be reused resulting in a _memory leak_.

It is possible that the SpanWriter will outright ditch the initial buffer if resize is set to true and growing is needed. To check/account for that we can do the following:

```cs
public static void SomeMethod()
{
    Span<byte> span = stackalloc byte[512];
    using var writer = new SpanWriter(span, true);
    // write some stuff that causes the span to grow
    
    span = writer.RawBuffer;
    // Do stuff with the span
}
```

Make sure you don't accidentally `Dispose()` the writer or use the `RawBuffer` outside of the `using` block. If you do, bad things will happen! (NullPointerException, or a fresh SpanWriter with no buffer, depending on the situation).

SpanWriter can also now be used with a fixed statement since it has a `PinnableReference()` function.
2020-12-31 19:57:02 -08:00
.github fix(core): NPE in Cycles per second (#331) 2020-11-30 23:12:16 -08:00
Distribution/Data Replacing Networking (#271) 2020-10-20 20:55:19 -07:00
docs docs: Fixes embed images for modernuo.com (#334) 2020-12-07 09:52:03 -08:00
Projects feat(core): Makes spanwriter resizable (#376) 2020-12-31 19:57:02 -08:00
.editorconfig Adds ModernUO docs skeleton (#243) 2020-09-13 15:21:28 -07:00
.gitattributes More gitattributes diff/line ending fixes (#269) 2020-10-01 21:38:42 -07:00
.gitignore fix(core): Adds IPv6 support (#348) 2020-12-19 00:27:39 -08:00
azure-pipelines.yml Drop .NET Core 3.1 (#307) 2020-11-10 20:28:05 -08:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md 2020-05-05 08:51:39 -07:00
CONTRIBUTING.md Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
Directory.Build.props feat(core): Makes spanwriter resizable (#376) 2020-12-31 19:57:02 -08:00
FAQ.md Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
GOALS.md Updates to .NET Core 3.1 & Cleanup (#79) 2020-01-19 12:47:34 -08:00
LICENSE Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
mkdocs.yml Creates quick start (#254) 2020-09-15 19:46:10 -07:00
ModernUO.sln Adds back in old benchmarks. Cleans up tests. (#270) 2020-10-04 11:45:07 -07:00
publish.cmd fix(publish): Removes or from publish script (#340) 2020-12-11 19:37:02 -08:00
publish.sh Release Version 0.6.1 (#205) 2020-08-30 23:15:47 -07:00
README.md Updates README to include Big Sur (#318) 2020-11-17 13:06:58 -08:00
rider-settings.zip Cleanup/Housekeeping (#242) 2020-09-12 15:31:21 -07:00
Rules.ruleset Cleanup & Fixes for .NET 5 (#309) 2020-11-15 10:03:50 -08:00
RUNUO_MIGRATIONS.md Fixes more line ending issues (#267) 2020-09-27 13:54:56 -07:00
stylecop.json Updates formatting rules (#199) 2020-08-25 18:00:51 -07:00
THIRD-PARTY-NOTICES Updates span extensions (#276) 2020-10-17 21:14:03 -07:00
version.json Fixes NBGV & Adds Big Sur to CI/CD (#317) 2020-11-17 13:02:51 -08:00

ModernUO Discord Subreddit subscribers Twitter Follow Gitter

Ultima Online Server Emulator for the modern era!

.NET
Windows OSX Debian Ubuntu CentOS
GitHub license GitHub stars GitHub issues
GitHub build AzurePipelines build

Building the server

Requirements

Publishing Builds

  • Using terminal or powershell: ./publish.cmd [release|debug (default: release)] [os]
    • os - Supported operating systems
      • win - Windows 8.1/10/2016/2019
      • osx - MacOS 10.13+/11.0 (High Sierra, Mojave, Catalina, & Big Sur)
      • ubuntu.16.04, ubuntu.18.04 ubuntu.20.04 - Ubuntu LTS
      • debian.9, debian.10 - Debian
      • centos.7, centos.8 - CentOS
      • If blank, the operating system running the build is used

Deploying / Running Server

  • Follow the publish instructions
  • Copy Distribution directory to the production server

Requirements

Running

  • dotnet ModernUO.dll

Cleaning

  • dotnet clean

Thanks

  • RunUO Team & Community
  • ServUO Team & Community
  • Karasho, Jaedan and the ClassicUO Community

Troubleshooting / FAQ



Development Tools provided with ♥ by