- Home /
Tools to profile memory usage
The unity 3(.3) profiler does not help me profile my scripts memory usage since it only shows the total memory usage. Furthermore, so far the (.NET) memory profiling tools I've tried all don't work for Unity games.
What tools can be used to profile memory usage?
Also looking for a memory profile tool for Unity applications
I'm not sure what you actually want the profiler to display. Every object has some kind of memory usage and that is its member variables. Referenced objects can't be count for a certain class instance since multiple instances can hold the same reference. So every object is on its own.
$$anonymous$$ost objects are placed on the heap and don't belong to the creator object. They just eats up memory but you can't refer to a specific Unity script which might have created the instance.
So what kind of view / display do you want / expect?
It would be nice to get a fragmented overview of the Unity application's memory usage. $$anonymous$$y company is having problems figuring out what the application's memory is used on. Our application uses 1.6GB and there is about 1GB we can't account for. Is it used on Unity assets, $$anonymous$$ono objects or something totally different? It is hard for us find out easily.
Yeah it's always useful to be able to track each individual allocation and the call-stack when it was allocated. Currently seeing a 700 kB allocation every few seconds in my game but I have no way of profiling for it.
$$anonymous$$ono supports at least parts of the System.GC (garbage collector) interface, which might be helpful, though it won't tell you about unmanaged allocations inside the Unity engine. $$anonymous$$ore details here -- http://msdn.microsoft.com/en-us/library/system.gc_members(v=vs.90).aspx
Answer by yoyo · May 14, 2013 at 04:30 AM
As of Unity 4.1, Pro version, the best solution is the Memory Profiler, first introduced in this blog post.
For Unity Free, you could use Resources.FindObjectsOfTypeAll to see what you have loaded. It won't find every little allocation, but at least you can track down the big ones -- textures, audio clips, meshes, etc. Or try searching the Asset Store for memory profiling tools.
Your answer
Follow this Question
Related Questions
Total memory allocated increases indefinately from .80GB untill crash 3 Answers
Is there a Unity Game Object information Screen? 1 Answer
Why are compressed textures showing up huge in memory? 0 Answers
Memory profile shows "Profiler" using hundreds of MB - is this OK? 1 Answer
Memory Management and List 6 Answers