Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

"some allocations have not been deleted, yet reference count is 0. This should not happen"

Discussion in 'Scripting' started by Antrare, Dec 30, 2015.

  1. Antrare

    Antrare

    Joined:
    Sep 25, 2015
    Posts:
    3
    Not sure where this should actually be placed, however, when I run my game in the Unity player, and subsequently stop it, I get about 10 of the above Error messages in console. Upon running the application again, it crashes Unity.

    This error message has appeared only since upgrading to 5.3, however, I had been getting random crashes of unity before then with no detail as to why (and not repeatable).

    Any thoughts on where/what I should be looking at?
     
  2. NoobHelper

    NoobHelper

    Joined:
    Dec 30, 2015
    Posts:
    6
    Seems like this could be some really bad coding on your part lol ;). Possibly memory leaks.....[?]. It's tough to say without the complete error and the script it's pointing to. Without seeing the code it's going to be tough to pinpoint.
     
  3. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Ouch. You broke the garbage collector. That's not even supposed to be possible.

    This definitely needs a bug report.

    Are you doing anything unusual in code? Running anything unsafe? Using any native plugins?

    Does this happen on all projects or just one?
     
  4. Antrare

    Antrare

    Joined:
    Sep 25, 2015
    Posts:
    3
    Unfortunately that is the complete error, and it doesn't point to any specific code... My gut feel is that I had this error in previous versions of unity, but only now is it throwing an error code (making reverting back to old code and checking where/if I introduced the problem virtually impossible without starting again).

    I'm currently using GooglePlayServices (latest version) and also Online Maps (latest version) - https://www.assetstore.unity3d.com/en/#!/content/13261

    The rest of it is my own code. Currently just the one project that I'm working on.
     
  5. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
  6. Antrare

    Antrare

    Joined:
    Sep 25, 2015
    Posts:
    3
    Attached the crash dump file. If you want others, please let me know. The "consistent" crashing I was able to produce before seems to have gone back to "random", I'll take a copy of the other logs when I get another crash just in case they would help.
     

    Attached Files:

  7. lordofduct

    lordofduct

    Joined:
    Oct 3, 2011
    Posts:
    8,380
    not the crash dump, the actual log, as in my link

    though the crash log might be of help as well
     
    Last edited: Dec 31, 2015
  8. TwILeK

    TwILeK

    Joined:
    Sep 17, 2014
    Posts:
    54
    Hi

    I have same problem when upgraded to unity5.3
    In unity 5.2 i can play without any crash, updated to unity 5.3 get crash after 10 seconds ...

    Ok, it's my bug, native plugin bug, etc, etc ... but while don't crash in unity 5.2? and why crash in unity 5.3? (in C# is hard to kill the garbage collector :))

    In the log, no call stack, just:
    some allocations have not been deleted, yet reference count is 0. This should not happen

    (Filename: C:/buildslave/unity/build/Runtime/Profiler/MemoryProfiler.cpp Line: 92)

    Crash!!!
     
  9. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    In software development it is very common that changes happen between versions. This can lead to issues. The issues can be caused by Unity, by third party plugins that don't use certain APIs as expected and it accidentally worked in previous versions or something needs to be compiled again. It can be custom code that was very bad and wasn't as harmful in the previous version. I have seen people with projects that had tons of error messages and warning in the console and after an upgrade they were surprised it is not anymore working.

    A good start might be to share a little more information about which kind of 3rd party plugin you are using (if any). And what kind of special functionality you might be using in Unity.
     
  10. TwILeK

    TwILeK

    Joined:
    Sep 17, 2014
    Posts:
    54
    Hi
    I have 0 (zero) warning because the warning is error ...
    I use WWIse and NLua. I hope that the wwise is not crash, and i use lua ... from 10 years ago :)

    But i think not valid, that unity crash when get these error message. Unity crash full randomly ...
    5.3 crashes 8 out of 10 times when i start a scene ... (~ random call stacks ...)
    5.2 crashes 1 out of 100 times when i start a scene ... (at these point i see why)
     
  11. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Wwise is using native code as far as I know. When it has some invalid calls for whatever reason, it will crash Unity easily. That's just the nature of native code plugins. You find out whether Wwise is the problem by using it in an empty project and by checking whether it crashes. If it does, it is the fault of Wwise and not Unity.
    Don't know whether NLua uses native code too.
     
  12. TwILeK

    TwILeK

    Joined:
    Sep 17, 2014
    Posts:
    54
    WWise and NLua use native code too
    But, we testing the 5.3 on 2 machines, and use 5.2 on 10 machines
    5.3 crashing randomly (like: SetAsActiveWindow :))
    5.2 NOT crashing (source code is equal (SceneManager replaced)) ... so i think can't say that the wwise run invalid calls :D
     
  13. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    With the new scene manager in place, it is not that unlikely that it had some impact on the scripts and their execution. Those changes can mean that even if the execution worked in 5.2, it doesn't anymore in 5.3. It can definitely mean that the calls to Wwise or NLua become troublesome.
     
  14. dburden1

    dburden1

    Joined:
    Jan 29, 2015
    Posts:
    19
    We've started getting this issue since 5.3 as well. Has anybody found a workaround? Our code isn't really doing anything unusual.
     
  15. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    Do you use native code plugins?
     
  16. TwILeK

    TwILeK

    Joined:
    Sep 17, 2014
    Posts:
    54
    I uninstall 5.3 and install 5.2 and don't crash :)
    So i think NOT native plugin error!
    Unity 5.3 randomly crashing! Switch back to 5.2
     
  17. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    I am not saying that it is not a bug in Unity 5.3. However, it is absolutely possible that it is not. I have seen a lot of code, e.g. editor extensions or native code plugins that make certain assumptions about how Unity works. The code was just made such that it works in the version in which it was developed. It is often not surprising for me that it doesn't work in later versions.
    If you want to do something about it, you have to find out at least what causes the issue. Just stating it is Unity's fault because it worked in the previous version is for sure an oversimplification.
     
  18. ina

    ina

    Joined:
    Nov 15, 2010
    Posts:
    1,059