Unity Community


Page 1 of 2 12 LastLast
Results 1 to 20 of 28

  1. Posts
    15

    Memory-leak galore

    Below is a cross post from: http://answers.unity3d.com/questions...k-gallore.html

    At our company we have several projects relying heavily on Unity. We used all the tricks out there (http://answers.unity3d.com/questions...ment-tips.html), but somehow when we close our webplayer, one title still has 150 MB and another has 200 MB of unreleased memory (both in Firefox and Chrome). What is worse, is that when you start a new game, without killing the previous plugin container, it simply adds to this memory residue, so it's not a question of caching. The editor too, appears to have this problem.

    Now, of course, you can accuse us of bad programming. Sure. We're the worst programmers ever. However, it cannot be that the virtual machine does not release the memory claimed by our games, anno 2011. So my question is twofold:

    * Do other developers recognize any of this?
    * When is Unity3D going to upgrade its version of Mono? (and don't say it's too ingrained in Unity, that's what design patterns are for)

    "Too many heap sections" ---> http://tirania.org/blog/archive/2009/Nov-09.html

    Sorry for the tone, but something needs to be done, since 3.5, at the moment, doesn't hint at any improvement in this area.

    ps: Starting the game again and closing it adds 150 or 200 mb respectively, so the residue increases 150, 300, 450 etc. And remember that users have more than 1 tab open, so machines start swapping rather fast.
    pps: Another thing we've looked at http://answers.unity3d.com/questions...-and-list.html


  2. Location
    Montréal Quebec
    Posts
    2,235
    File a bug with a repro case. Unity staff will surely fix it.
    Forgotten Memories Teaser
    Forgotten Memories Trailer
    I write shaders for the community!
    Dead Strike iOS (Top iOS game made with Unity).
    Nintendo Wii U and Sony (PS3/PS4/Vita) Licensed Developer/Publisher.
    __________________________________________________
    Georges Paz
    http://www.forgottenmemoriesthegame.com


  3. Posts
    15
    Good point. However, I've found numerous posts on this issue. I refuse to believe that they are not aware of this problem.

    Furthermore, there is a danger in using too many tricks to dance with Unity's GC, because some of them actually contain performance penalties, if Unity decides to upgrade its GC....


  4. Location
    Yukon
    Posts
    668
    A lot of time people complain first, and report as a last resort, reporting first would probably get a lot of these bugs fixed


  5. Location
    Montréal Quebec
    Posts
    2,235
    Quote Originally Posted by Boondock_Saint View Post
    Good point. However, I've found numerous posts on this issue. I refuse to believe that they are not aware of this problem.

    Furthermore, there is a danger in using too many tricks to dance with Unity's GC, because some of them actually contain performance penalties, if Unity decides to upgrade its GC....
    I'm on the Unity beta list, if you could provide me with something that repro those issues i can make a thread on the beta list and your bug will get some direct attention (though isn't necessary but I'll make sure they will hear me first).
    Forgotten Memories Teaser
    Forgotten Memories Trailer
    I write shaders for the community!
    Dead Strike iOS (Top iOS game made with Unity).
    Nintendo Wii U and Sony (PS3/PS4/Vita) Licensed Developer/Publisher.
    __________________________________________________
    Georges Paz
    http://www.forgottenmemoriesthegame.com


  6. Posts
    15
    Yes, but Unity developers also read and post on the forum and the Answers section.

    But we are working on a bug report, simply to get that response out of the way


  7. Location
    Montréal Quebec
    Posts
    2,235
    Quote Originally Posted by Boondock_Saint View Post
    Yes, but Unity developers also read and post on the forum and the Answers section.

    But we are working on a bug report, simply to get that response out of the way
    Awesome,
    Let me know if/when i can help you.
    Forgotten Memories Teaser
    Forgotten Memories Trailer
    I write shaders for the community!
    Dead Strike iOS (Top iOS game made with Unity).
    Nintendo Wii U and Sony (PS3/PS4/Vita) Licensed Developer/Publisher.
    __________________________________________________
    Georges Paz
    http://www.forgottenmemoriesthegame.com


  8. Posts
    15
    Quote Originally Posted by tatoforever View Post
    Awesome,
    Let me know if/when i can help you.
    That's very kind of you, tatoforever! Maybe we will

    In the meantime: Have you never ever encountered the "Too many heap sections" error message?


  9. Location
    Yukon
    Posts
    668
    Quote Originally Posted by Boondock_Saint View Post
    That's very kind of you, tatoforever! Maybe we will

    In the meantime: Have you never ever encountered the "Too many heap sections" error message?
    When they told me the all you can eat buffet was not actually....

    Oh programmer stuffs


  10. Posts
    15
    Quote Originally Posted by larvantholos View Post
    When they told me the all you can eat buffet was not actually....

    Oh programmer stuffs
    Yes, sure, we ate it all. But when we leave, shouldn't Unity give it back to the restaurant?

    Furthermore, someone just pointed my attention to this:

    http://feedback.unity3d.com/forums/1...ection-sgen-gc


  11. Location
    Boulder, CO
    Posts
    79
    Thanks for the poll link. Just went and cast my vote there as well.

    I have seen numerous issues with the garbage collector in the games / visualizations we've been working. I was getting a huge (100s of MB) leak like Boondock_Saint when trying to use List<>s to read in a binary file and use it to build multiple meshes. Every time I would Clear() or otherwise try to reset the List<> for the next run of the loop it would simply add to the existing memory rather than replacing it, and this problem existed even after closing Unity, both in the editor and standalone app.

    Additionally, the GC often doesn't play nice at all with the community ocean model, causing large garbage spikes that freeze the game, though I haven't poked through it enough to be certain it isn't just a bug with the code.


  12. Posts
    1,107
    Quote Originally Posted by tatoforever View Post
    File a bug with a repro case. Unity staff will surely fix it.
    I reported similar memory leak more than 1 year ago (it was there since unity 3.0 beta). According to change log it was fixed in 3.4.1 (Fixed texture importer rescan memory leak, which caused out of memory crashes.), but according to my testing it is still there (I was able to crash unity by browsing textures in large project). So my answer is no. Until there is 50 people on the forum, who are complaining each day, no effort to fix this. There are more important tasks then fixing bug, adding lots of fancy features and xbox and ps3 support, this is what makes money!

    Anyway there must be filled bug report, or the chance of fixing is ZERO.
    Last edited by Demostenes; 11-13-2011 at 07:50 AM.


  13. Posts
    15
    Yes, we also suspect the textures to be part of it.

    Concerning the bug report: We are one of the bigger customers of Unity, so we're going via the direct route. I don't know exactly what that will look like yet (I'm not the contact between Unity and the company), but I'll keep you posted.


  14. Posts
    15
    Ok, it's been communicated to Unity. Now it's hoping for a reply


  15. Posts
    2,317
    In my experience, since you are running this in a browser, I would suggest you publish it to run stand alone and compare the metrics with the browser version. I bet the problem goes away, especial since you are using Firefox and it's plugin container. Try running it in other versions of other browser and older versions of Firefox.


  16. Posts
    15
    No, Chrome has the same problem. Also, it is a browser game, so we don't have much choice in the matter. Even if a standalone doesn't have this problem, that still means the problem has to be solved for the webplayer, and even if Internet Explorer doesn't have this problem, we cannot ignore the users that are using Firefox and Chrome


  17. Location
    Zürich, Switzerland
    Posts
    26,572
    It just means that you must use a smarter trick to force Chrome and Firefox to really close the plugin.

    It seems at the time they play 'smart and optimized' by not releasing the plugin as such the old one is not released as it relies on plugin termination to do it. Out of head the only way that I could think of as a working way is a full intermediate page without it so it can't auto optimize the plugin handling 'to keep it alive' as it would do with a normal page refresh (a full force refresh should reload the whole container too)


  18. Posts
    2,317
    Is this chrome plugin a java container? Firefox used to be nothing more than a java program wrapped in a jvm exe. I bet Chrome is too. Although it's a browser game I would still compile it for standalone & compare. If standalone has the same problem you can bet Unity will be all over it. I'm not really a windows guy but if you run it in osX attach whatever osX's equivalent to 'truss' is to the browser game instance.


  19. Posts
    15
    Ok, I'm not exactly sure what you mean. Loading a new page in the same tab should destroy the plugin container, but actually closing the tab (as most users will do) doesn't?

    Also, as mentioned in the GP, there is no caching there. Refreshing the page (so starting the game new), only adds to the memory residue.

    For the record: Of course we put all kind of GC calls into Main.OnApplicationQuit(), but this brought nothing, except that it took a bit longer to close the tab (indicating that the calls were executed).


  20. Posts
    15
    Quote Originally Posted by goat View Post
    Is this chrome plugin a java container? Firefox used to be nothing more than a java program wrapped in a jvm exe. I bet Chrome is too. Although it's a browser game I would still compile it for standalone & compare. If standalone has the same problem you can bet Unity will be all over it. I'm not really a windows guy but if you run it in osX attach whatever osX's equivalent to 'truss' is to the browser game instance.
    The plugin is the plugin downloaded from unity3d.com. If it's wrapped in Java, then it's done by UnityTech. However, for the sake of argument, I'll build a standalone.

    Also: Firefox a Java program?!?! Do you have a source for that? (It's written in C++)

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •