Thursday, June 18, 2015

The Memory Leak Conundrum comes to an end :)


Over the course of the last month a few things have happened. Bob's world has quieted down, his house is now a little bit more empty and he's been producing some incredible model work for the walls of the study in Manifest. We've begun searching for new talent again, in particular a coder to help us speed up the production of our assets alongside Manifest. Finally, the coder search is spurred by a memory leak we began experiencing a few weeks ago.

After a long bout of research on the subject of Unity's automatic memory management, I had tried everything I could think of. Loading up the story tool, opening the dialogue editor, and then finally - opening the attribute editor, that's when it would crash. I'd offer a picture of this, but I couldn't have taken one, it was that bad. Particularly when trying to open the window, Unity would overload the stack and fill up RAM. It happened so quickly, that my computer would freeze instantly and I would have to hard kill it (or in this case, hard reset using a button on the front of my tower) and start again.

So after weeks of research and experimentation, I decided to step back and look at the problem with a different perspective. What had changed? My initial thoughts were nothing. I had done some updates to the in-game UI, but nothing that should affect the tool. My worst fear was that I had made such an unmanageable mess of the program that the last update had caused the stack to finally just barely overflow to the heap, and the heap was just not enjoying what I had set up. Then I thought, maybe it has to do with the age variable and modified value options I had added a couple updates before, but the error was simply only happening now.

The answer, of course, was it wasn't me or my code at all. At least not directly. At some point during a compile during the most recent update, I had a strange error occur. Just like vexe, I'd had a layout crash. Apparently, when a compile error happens in Unity, there is a slight chance it will corrupt your layout config? I'm not entirely sure how this error happens, but something along those lines. Anyway, the result was that a simple reinstall did not fix the problem. So I had passed off the concept that it was Unity early on, thinking I had already tested for this. Also like vexe, I had to remove every trace of it from my computer, where this thread came in handy for locating all those problems.

If you've had a layout crash in Unity or a custom editor window you've been working on randomly ceases to work, hard clear your installation and reinstall!! Registry and all! I suppose this is a bit of a pain, but it seems to be caused by user-error in the long run and a wipe isn't so hard to achieve. I just wish I hadn't spent so long trying to fix this error... At least I've become very well acquainted with manipulating Unity's GC :)



No comments:

Post a Comment