Search Unity

ECS Error & Editor Crash?

Discussion in 'Entity Component System' started by nttLIVE, Dec 1, 2018.

  1. nttLIVE

    nttLIVE

    Joined:
    Sep 13, 2018
    Posts:
    80
    Recently I've been getting this error message every time I press "Play" on my Unity Project.

    A Native Collection has not been disposed, resulting in a memory leak. It was allocated at :0.


    Usually I get this error if I "Stop" my player and I forget to dispose a native collection with the actual reference to where I missed a deallocation, now I have no idea where this could be happening. I believe this is also the cause of my editor doing a silent crash when I close it after working on the project because all my other projects using ECS and Unity 2018.3.0b3-12 have no issues.

    The builds (Win 64bit) of the project are also silent crashing when closed.

    Some one else experiencing this? Or might know where exactly this memory leak is happening?
     
  2. eizenhorn

    eizenhorn

    Joined:
    Oct 17, 2016
    Posts:
    2,683
    Not only, if some thing breaks before disposing, then native collection not dispose, and it can be at first frame :) Did you check first error message in console?
     
  3. Xerioz

    Xerioz

    Joined:
    Aug 13, 2013
    Posts:
    104
    You get this error if you previously ( last time you ran the project in editor ) didn't dispose your collections properly. They will accumulate and eventually crash the editor.

    The fact that it only mentions the error after running the game on the next play session is a bug that hasn't been fixed yet. Normally it should give you that error when stopping your session.
     
  4. nttLIVE

    nttLIVE

    Joined:
    Sep 13, 2018
    Posts:
    80
    I understand what you mean but for this case the only error message is the Memory Leak one. Every system works as intended.
    Unfortunate. I'll have a try at digging at my code to find the leak like a needle in a haystack. :rolleyes:
     
  5. 5argon

    5argon

    Joined:
    Jun 10, 2013
    Posts:
    1,555
    It is possible if the Editor World is using NativeArray on some systems with execute in edit mode or some editor scripts and it does not dispose. Try disabling the default world and see if the problem goes away? Or go to a scene with no GameObjectEntity and enter play mode.
     
  6. nttLIVE

    nttLIVE

    Joined:
    Sep 13, 2018
    Posts:
    80
    I found the problem, an ECB was being allocated on a different thread and wasn't getting disposed on application close. It's weird because it's on a script that hasn't been touched for months and the error just recently started to appear. Oh well. :confused: