Small memory leaks? (Unity 3.0.0f1)

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 :sweat_smile:

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.

01 - The Scene:

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

05 - Instruments - Call Tree

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 :smile:

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 :sweat_smile:

If it uses 11mb you are actually lucky.

Its normal for unity to take up 12 - 17mb already with starting up due to the unity engine and mono which both end in the ram as they are application code.

Thank you for the quick reply dreamora.

Aha, I’ll remember that :slight_smile:

After rebuilding the project with the new 3.0.0f2 version, most of the leaks seems to have disappeared. It only reports the autorelease pool now.

I had a few small leaks with 2.x that I couldn’t seem to resolve as problems in my own code (which doesn’t mean they weren’t).

That said App runs for hours without an issue and was approved by Apple so I wouldn’t worry too much about minor leaks.

Is it normal to have the autorelease pool be flagged as a leak? how do i stop this from coming up in instruments as a leak?