Hi,
I’m pretty new with Unity (actually bought the pro version two days ago after using the trial version for 2 weeks), so please bear with me ![]()
I whipped up a quick test scene by using the “2D Side Scroller” prefab and added some objects here and there. The project builds perfectly, and I do not experience any crashes or things like that, but after running the app in “Instruments”, it reported some memory leaks.
To (hopefully) show the errors properly, I’ve attached some images below.
As you can see there isn’t much going on in the scene. I’ve added some 2D boxes, a floor, and a not so beautiful stretched texture of the sky. The gui text is just for debugging purposes and shows the Y position of the player
txt_pos.text = "Y = " + character.transform.position.y.ToString();
02 - Instruments - Allocation 28 seconds in (After the splash screen)
By looking at the graph, it seems like the leaks came in two batches, one while it was loading, and the rest when in the first seconds while the game was starting up.
03 - Instruments - Allocation 5 minutes in
I stopped the application after 5 minutes, and as you can see from the next couple of images, the usage was about the same as when I started it. My uneducated guess would be that this happened only on load, and it wasn’t some object or other thing that got called while the game was running and got built up over time.
04 - Instruments - Leaked blocks
06 - Instruments - History - UIKit
07 - Instruments - History - libstdc
08 - Instruments - History - Foundation
09 - Instruments - Allocation - 16B
There were 2068 instances of the “…DelegatesForURL” that was referenced as one of the leaks (although this was in the 16 Bytes allocation). For all I know this is normal, but I was just thrown off by the “URL” in the sentence and thought it should be mentioned.
So without me rambling away for ages, the questions are as follows:
Q1: Has anyone else experienced the same thing, or have any clues about what might be wrong? I’ve tried to delete and disable all the scripts, but it didn’t help.
Q2: Does this quite simple app use 11,04MB RAM already, or does Unity allocate some extra ram for future usage?
Love the community by the way. Have been lurking around for a while now and keep learning new stuff every day from you guys ![]()
In advance, thanks!
Edit:
Sorry about the insanely huge images. I just bought a 27" iMac and I don’t have any image applications that can resize the images. Was hoping the forum had an auto resize plugin installed ![]()