A Native Collection has not been disposed, resulting in a memory leak

I haven’t personally worked with the NetCode-package yet, but from that trace I can tell that the NetworkList-constructor is using a NativeList underneath.
NativeList (and NativeArray) are managed wrappers around unmanaged memory-allocations. You need to Dispose these once you’re done with them so you don’t leak memory (e.g. in the OnDestroy() of your class).

There seems to be a similar question posted here:

which makes it look like the NetworkBehaviour should be handling the lifecycle of these lists (instead of you creating them yourself)?

1 Like