public unsafe void CheckShutdownFrees() { // (because of PlayerConnectionTestFixture.PerTestSetUp) MessageStreamManager.DestroyStreamBuilder(messageBuilder); // Kill any buffers already registered from the profiler system MessageStreamManager.Shutdown(); long sizePreInit = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent); // Start fresh MessageStreamManager.Initialize(); // The pointers returned by these 2 methods will get lost surely... MessageStreamManager.CreateStreamBuilder(); MessageStreamManager.CreateStreamBuilder(); long sizeCreate = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent); MessageStreamManager.Shutdown(); long sizeShutdown = UnsafeUtility.GetHeapSize(Collections.Allocator.Persistent); // (because of PlayerConnectionTestFixture.PerTestTearDown) // (also do this prior to asserts in case of test failure so tear down doesn't fail and we miss the real issue) MessageStreamManager.Initialize(); messageBuilder = MessageStreamManager.CreateStreamBuilder(); Assert.IsTrue(sizePreInit < sizeCreate); Assert.IsTrue(sizePreInit == sizeShutdown); }
// This happens in the default Initialize() method. // However, separate to support tests without having to // a) initialize all of player connection if it's not used otherwise // b) make the MessageStream api public when it otherwise doesn't need to be public static void InitializeMessageStreamManager() { MessageStreamManager.Initialize(); }