- Home /
PlayInEditor Memory Crash
I'm creating a board game in Unity and I've been having trouble with the editor crashing due to an out of memory error. I have very few GameObjects and textures at this point; most of what I have is just unityscript code. For various reasons, in part having to do with the AI, most of my work is done in classes that don't extend from MonoBehaviour.
Almost all of these classes extend from the class VirtualObject. This system was working fine until this afternoon when I added a new parameter to VirtualObject. Now when I go to run in the Editor, it consumes ~3.5gb of memory and then crashes.
This is the first part of what I believe is causing the crash.
class VirtualObject{
var gameParent : VirtualObject;
var children : List.<VirtualObject>;
var dirty : boolean = false;
var objectType : ObjectTypes;
var game : Game = null;
var funnythinglongname: Game = null;
}
If I comment out the line "var funnythinglongname : Game = null;" I no longer get the crash, spike memory to around 1.2 gb (which still seems nuts to me, but I'm not an expert) and can play. That line is completely unused at the moment (though I'd obviously like to use it or at the very least understand why I can't use it). Game is another class that does not extend from Monobehaviour.
If it helps, there are probably ~50 VirtualObjects hanging around in my scene after launch, all of which get created on startup. What I've listed is at least 1/3 of what they store (so none of the children are more than 3x this size).
Does anyone have a suggestion for why an unused reference on ~50 objects would cost ~2gb of RAM?
Thank you very much
Your answer
Follow this Question
Related Questions
Memory Leak Adventures in Editor (3.4, lot of instantiated objects) 1 Answer
Unity says: "The System is Running out of memory." when it is not. 5 Answers
Out of memory when switching back from Monodevelop 0 Answers
Why does allocation heavy code not scale to multiple threads? 0 Answers
How to Disable Unloading of Assets During Bundling 0 Answers