찾기
내용으로 건너뛰기
추적
문서의 이전 판을 선택했습니다!
저장하면 이 자료로 새 판을 만듭니다.
미디어 파일
======Heapshot (Pro only)====== _Supported platforms: Mac/PC Standalone player, iOS, Xbox360, PS3._ _Note: doesn't work with Script Debugging enabled._ This utility captures a heapshot and shows all managed objects which are currently _alive_. It also shows references and back-trace references between objects. This helps easily identify why are some objects not being collected by the garbage collector. Heapshot uses profiler for data sending, thus the profiler needs to be enabled. {{:unity3d:alloc3.jpg}}\\ Build the player and launch it. Then go in editor go to Windows->Heapshot, a window similar to profiler will open. Click on _Active Profiler_ to select the target you'll be examining, ignore the _Editor_ selection, as you can't capture heapshot from the editor. Now click on _Capture heapshot_. _Note: if you're capturing heapshot from Mac/PC standalone, you have to give focus to player window, as only then the heapshot data will be sent to editor, so in short switch to player's window and then back to Editor._ The test script which was used while capturing heapshot: <file csharp> public class TestingHeapshot : MonoBehaviour { public class StaticClass { int someData; } public class DynamicClass { int someData; } private static StaticClass staticClass = new StaticClass(); private DynamicClass dynamicClass = null; void OnGUI() { if (GUILayout.Button("Allocate")) dynamicClass = new DynamicClass(); if (GUILayout.Button("Free")) dynamicClass = null; } } </file> You should see something like this: {{:unity3d:alloc1.jpg}}\\ In the left side you should see two tabs: * Roots - these are statically created objects, which aren't referenced by anything and are always _alive_. * Objects - here you can see all the objects which are currently _alive_, because they're are either referenced by a static object or by Unity engine itself, this usually applies for UnityEngine.* classes. On the left side, I've selected the object of type _TestingHeapshot/StaticClass_, the field name says (Unknown) because one object can be referenced by multiple fields, so it's impossible to name a field to which the object belongs. On the right side, we can see that our object is referenced by _staticClass_ field, that's why it is _alive_ and not being collected by the garbage collector. There are no objects of _TestingHeapshot/DynamicClass_ type currently. But if we would execute: <file csharp> dynamicClass = new DynamicClass(); </file> and capture a heapshot, we would see: {{:unity3d:alloc2.jpg}}\\ We can see that _TestingHeapshot/DynamicClass_ is being referenced by _dynamicClass_ field in _TestingHeapshot_ class, moving along references we see that _TestingHeapshot_ is being referenced by _<Unity>_, this is because _TestingHeapshot_ is a _MonoBehaviour_ and it's attached to a game object, so Unity references that object until the component _TestingHeapshot_ is removed from the game object. Good luck finding those leaks ! {{tag>유니티 unity}} * 출처: [[http://unitykoreawiki.com/index.php?n=KrMain.Heapshot|유니티코리아위키]] (CC BY-NC-SA 2.0)
2+1?
이 필드는 비어 있도록 유지하세요:
저장
미리 보기
취소
편집 요약
참고: 이 문서를 편집하면 내용은 다음 라이선스에 따라 배포하는 데 동의하는 것으로 간주합니다:
CC Attribution-Noncommercial-Share Alike 4.0 International
문서 도구
문서 보기
이전 판
연결문서
맨 위로
다크 모드로 보기
☀️
Toggle Menu
유니티3D ( Unity3D )
너두 고쳐두 됩니다.
사이트 도구
최근 바뀜
미디어 관리자
사이트맵
사용자 도구
등록
로긴
최근 수정된 문서
misuse_topical5
노박
unique_items
dinner_bell
deputy_beagle
ratslayer
one_for_my_baby
alerio
power_fist
제거됨
fixer
climb_ev_ry_mountain
companion
[장비 분실]
crashed_vertibird
brotherhood_t-51b_power_armor
marco
i_forgot_to_remember_to_forget
cateye