MemoryProfiler

Unity 5.3a4 has a new very lowlevel memory profiler API. It can tell you which objects got blamed for how much C++ memory allocations. On IL2CPP and Mono .NET 3.5 platforms, it will also give you a dump of the entire C# heap, as well as C# type descriptions.

This API is too low level for most people to benefit from. The intention is to write a much nicer UI window ontop of this API that will actually be readily useful for many users, in helping them figure out which objects are loaded, which objects take a lot of memory, and most important, why that object is in memory. This repository is that nicer UI window, very much in progress of being built.

A common pattern of "memory leaks" that we see, is if you have a C# class with a static field, that contains a list, that has an object, which has a reference to a big Texture2D. This Texture2D will never be unloaded, because it is still reachable from C#. Figuring out this is the case is not very straightforward. This new memory profiler window will make it straight forward, and if you select the big Texture2D, it will show you a backtrace of references, all the way to the static C# field, (including the classname) that is causing this Texture2D to be loaded.

We have taken the, for us new, approach of shipping the low level API in the Unity product itself, and already opensourcing this memory profiler window long before it is "ready enough to be included in unity proper". We'll develop this window as an opensource project. Contributions are welcomed. At some point we'll feel that the feature is "good enough", at which point we'll most likely ship it out of the box with Unity.

Today, the UI part of this feature is still very rough. We decided to opensource it anyway, as when your project is in a state of "we need to use less memory, what do we do now", you probably care alot more about finding your memory leaks today, then finding them 6 months from now with nicer buttons and user experience.

Usage:

  • Make sure you're running Unity 5.3a4 or later for IL2CPP support.
  • Make sure you're running Unity 2017.3.0b1 or later for Mono .NET 3.5 support.
  • Build an il2cpp project & run it (any il2cpp platform should be fine).
  • Open the user project in this repository.
  • Open the normal profiler window.
  • Connect it to the player as you would normally profile.
  • Open the memory profiler window (Window->MemoryProfilerWindow)
  • Click "SnapShot".

U3D MemoryProfiler的更多相关文章

  1. U3D DrawCall优化手记

    在最近,使用U3D开发的游戏核心部分功能即将完成,中间由于各种历史原因,导致项目存在比较大的问题,这些问题在最后,恐怕只能通过一次彻底的重构来解决 现在的游戏跑起来会有接近130-170个左右的Dra ...

  2. U3D学习笔记1: HelloWorld

    Unity 版本: 5.3.5.f1 Hello World工程 1.新建工程 HelloWorld U3D可选2D和3D游戏   2.新建C#脚本文件 在project栏的assets目录右键-&g ...

  3. U3D笔记11:47 2016/11/30-15:15 2016/12/19

    11:47 2016/11/30Before you can load a level you have to add it to the list of levels used in the gam ...

  4. 跟我从零基础学习Unity3D开发--初识U3D

    首先声明,我也是才开始学,把自己学的记录下来也供一些想要学习的朋友参考,一起努力.希望大家能给我指点一下.切莫喷我. 什么是Unity3d呢? 百度百科------Unity是由Unity Techn ...

  5. 尝试u3d中将代码与编辑器分离

    最近与朋友交流,他一直是做端游,最近接触了u3d以后无法忍受代码与配置文件,美术资源全部纠缠在一起的状况,于是一直在琢磨怎么将编辑器与代码彻底分离. 自己也抽空研究一下,碰到一些问题先记录下来. 首先 ...

  6. u3d avatar部件的理解

    u3d中带动画的fbx文件导入的时候,就会显示一个avatar组件,这个到底干嘛的一直没能很好的理解,翻看网上的介绍,基本都是告诉你,设置humanoid类型动画时,拖拉过去之类,但是这玩意到底存储了 ...

  7. KSFramework:集成U3D热重载框架 - README

    KSFramework KEngine + SLua+ Framework = KSFramework KSFramework是一个整合KEngine.SLua的Unity 5开发框架,并为程序.美术 ...

  8. U3D中GameObject.Find无法找到元件

    U3D中GameObject.Find 如果某元件SetActive(false)了,Find()无法找到 因为Find()只会帮你找出正在活动中的物件,所以在将物件关闭前,我们必须将此物件放至预先定 ...

  9. U3D杂记

    1,点击UI上的登录按钮,从脚本发出ioo.netmanager.SendConnet->进入CS->soketclient.sendconnet...->netmanager调用 ...

随机推荐

  1. Jmeter(十七)Logic Controllers 之 Interleave Controller

    Interleave Controller----交错控制器,对于交错控制器官方文档解释的很清楚,上例子: 可以看到运行一次 Interleave Controller下的Sampler,运行一次 I ...

  2. Keepalived+Nginx+tomcat实现系统的高可用

    Keepalived+Nginx+tomcat实现系统的高可用 1:安装vmware虚拟机 2:安装linux系统,我自己下载的centos6.5 3:安装JDK,tomcat 解压tomcat到/u ...

  3. 在线学习和在线凸优化(online learning and online convex optimization)—基础介绍1

    开启一个在线学习和在线凸优化框架专题学习: 1.首先介绍在线学习的相关概念 在线学习是在一系列连续的回合(rounds)中进行的: 在回合,学习机(learner)被给一个question:(一个向量 ...

  4. dict函数

    增 fromkeys(iterable, value) 用可迭代对象生成键,创建默认值相同的字典(value默认None) 删 pop(k) 通过k来删除字典元素, 找不到就会报错, 返回被删除字典元 ...

  5. 2-java内省机制(Introspector)

    来一个简单的示例吧 package com.my.test; import java.beans.BeanInfo; import java.beans.Introspector; import ja ...

  6. 通过创建临时表合并某一个库的hive小文件

    #!/bin/bash #需要指定hive中的库名 #set -x set -e DB=$1 if [ -z $1 ];then echo "Usage:$0 DbName" ex ...

  7. C#深入解析委托——C#中为什么要引入委托

    引言: 对于一些刚接触C# 不久的朋友可能会对C#中一些基本特性理解的不是很深,然而这些知识也是面试时面试官经常会问到的问题,所以我觉得有必要和一些接触C#不久的朋友分享下关于C#基础知识的文章,所以 ...

  8. sql语句中order by 多个字段同时排序的应用

    order  by 后面可以跟多个字段进行排序 用A1代表第一个字段,A2代表第二个字段 一.order by A1 , A2  desc   指的是用A1升序A2降序 二.order by A1 a ...

  9. sersync+rsync实现服务器文件实时同步

    sersync+rsync实现服务器文件实时同步 一.为什么要用rsync+sersync架构? 1.sersync是基于inotify开发的,类似于inotify-tools的工具 2.sersyn ...

  10. Solr查询参数sort(排序)

    摘要: Solr查询每一次返回的数据都有一定的顺序,特定顺序的结果对于业务来说可能非常重要. 不指定排序 一般我们不指定排序规则,这样的结果能满足大部分需求,默认是用文档的得分作为排序标准.相当于加上 ...