BoatAttack
BoatAttack copied to clipboard
A Native Collection has not been disposed, resulting in a memory leak error
After I finished a race and was brought back to the main menu screen. I noticed this error message as you can also see in the screenshot:
A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions) WaterSystem.BuoyantObject:SetupData() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:99) WaterSystem.BuoyantObject:Init() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:58) WaterSystem.BuoyantObject:OnEnable() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:105)
I was using the latest version of the Git clone of this project with Unity version 2019.3.4f1 when this error occurred.
After I finished a race and was brought back to the main menu screen. I noticed this error message as you can also see in the screenshot:
A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions) WaterSystem.BuoyantObject:SetupData() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:99) WaterSystem.BuoyantObject:Init() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:58) WaterSystem.BuoyantObject:OnEnable() (at Packages\com.verasl.water-system\Scripts\BuoyantObject.cs:105)
I was using the latest version of the Git clone of this project with Unity version 2019.3.4f1 when this error occurred.
In BuoyantObject.cs change the code can fix it: private void OnDisable() { LocalToWorldJob.Cleanup(_guid); // bool isNonPhysicalType = _buoyancyType == BuoyancyType.NonPhysical || _buoyancyType == BuoyancyType.NonPhysicalVoxel; if (isNonPhysicalType && _samplePoints != null && _samplePoints.IsCreated) { _samplePoints.Dispose(); } // } if _buoyancyType is physical type, in LocalToWorldJob.cs it will dispose the nativearray, but non physical type not disposed.
Problem fixed here : https://youtu.be/w6cRuLJQ7E0
Problem fixed here : https://youtu.be/w6cRuLJQ7E0
video has been removed :-/