Public NetworkLists potentially being auto instantiated but not disposed leading to a memory leak #3136
Labels
priority:high
This issue has high priority and we are focusing to resolve it
stat:imported
Status - Issue is tracked internally at Unity
type:bug
Bug Report
Description
When a network list is declared public sometimes as part of the serialisation process it looks like the list is instantiated, or at least partially, but it's never disposed leading to a Leak Detected message on the next recompile or play through. The list doesn't appear usable unless Initialise is called on it. Due to this instantiation there's no requirement for your own in Awake but if there is one it has no effect on this.
Public NetworkVariables are also auto instantiated but show no ill effects.
Reproduce Steps
There's a discussion and code example here.
Actual Outcome
Leak log - Leak Detected : Persistent allocates 4 individual allocations.
Expected Outcome
Public network lists are not auto instantiated.
Environment
Additional Context
Having a network list public seems to be the only way to see the contents of the list in the inspector as it won't show with [SerializeField].
This issue is also mentioned in #2862.
The text was updated successfully, but these errors were encountered: