发现了位于Native堆上严重的内存泄露

This commit is contained in:
2025-10-10 01:01:36 +08:00
parent 560b8f825c
commit 5539431a5b
6 changed files with 98 additions and 16 deletions

View File

@@ -158,13 +158,37 @@ PrefabInstance:
propertyPath: m_AnchorMin.x propertyPath: m_AnchorMin.x
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 388988344062002487, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 388988344062002487, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 388988344062002487, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 388988344062002487, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 737963510356043975, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 737963510356043975, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 775572912073539602, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 775572912073539602, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchoredPosition.x propertyPath: m_AnchoredPosition.x
value: -0.00001859665 value: -0.000014662743
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 775572912073539602, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 775572912073539602, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.000013947487 value: -0.000990873
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 997591790961255738, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 997591790961255738, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
@@ -202,6 +226,18 @@ PrefabInstance:
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 1896719660929114435, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1946711086260906226, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1946711086260906226, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1990926332213494272, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 1990926332213494272, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
value: 0 value: 0
@@ -242,6 +278,34 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2348122663873981995, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2348122663873981995, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2348122663873981995, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2348122663873981995, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2406476460239080808, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2406476460239080808, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2406476460239080808, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2521196912701259155, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 2521196912701259155, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
value: 1 value: 1
@@ -292,12 +356,20 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3369554770199677005, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 3369554770199677005, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0.0000010728836 value: -0.000009849668
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3400394456054819598, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 3400394456054819598, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 3444697562495124443, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3444697562495124443, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4490919212454996252, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 4490919212454996252, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.x propertyPath: m_AnchorMax.x
value: 0 value: 0
@@ -322,6 +394,14 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y propertyPath: m_AnchoredPosition.y
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4537333342180246510, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4537333342180246510, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4796788112176853989, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 4796788112176853989, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_Name propertyPath: m_Name
value: EditorWord value: EditorWord
@@ -334,6 +414,10 @@ PrefabInstance:
propertyPath: m_Value propertyPath: m_Value
value: 1 value: 1
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5832146162940797674, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: IsDisableGC
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6049043771459676306, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3} - target: {fileID: 6049043771459676306, guid: c659abfe74df5de47a769f8d52c18fcc, type: 3}
propertyPath: m_AnchorMax.y propertyPath: m_AnchorMax.y
value: 0 value: 0

View File

@@ -198,6 +198,7 @@ MonoBehaviour:
BPMFraction: 1 BPMFraction: 1
SongOffset: 0 SongOffset: 0
BPM: 60 BPM: 60
IsDisableGC: 0
ToolSongTimeButton: {fileID: 8680706935683541890} ToolSongTimeButton: {fileID: 8680706935683541890}
CameraPositionButton: {fileID: 8665890749222113748} CameraPositionButton: {fileID: 8665890749222113748}
CameraRotationButton: {fileID: 8233090674995911520} CameraRotationButton: {fileID: 8233090674995911520}

View File

@@ -278,9 +278,8 @@ namespace Demo.Game
private bool IsScrollTimeline = false; private bool IsScrollTimeline = false;
#if UNITY_EDITOR public ProfilerMarker s_PreparePerfMarkerForSetSongCurrentTime = new(nameof(GameController) + "RuntimeForSetSongCurrentTime");
public ProfilerMarker s_PreparePerfMarker = new(nameof(GameController) + "Runtime"); public ProfilerMarker s_PreparePerfMarker = new(nameof(GameController) + "Runtime");
#endif
private void Update() private void Update()
{ {
@@ -294,15 +293,15 @@ namespace Demo.Game
// TODO : 修正这个逻辑,这个逻辑是反常的 // TODO : 修正这个逻辑,这个逻辑是反常的
if (MainAudio.IsPlaying()) if (MainAudio.IsPlaying())
{ {
s_PreparePerfMarkerForSetSongCurrentTime.Begin();
SetSongCurrentTime(CurrentTime); SetSongCurrentTime(CurrentTime);
s_PreparePerfMarkerForSetSongCurrentTime.End();
MainObject.ScriptUpdate(CurrentTime, deltaTime, ScriptableObject.TickType.Update); MainObject.ScriptUpdate(CurrentTime, deltaTime, ScriptableObject.TickType.Update);
} }
if (IsMain == false) if (IsMain == false)
return; return;
#if UNITY_EDITOR
s_PreparePerfMarker.Begin(this); s_PreparePerfMarker.Begin(this);
#endif
#if UNITY_EDITOR #if UNITY_EDITOR
if (Keyboard.current[Key.LeftShift].isPressed) if (Keyboard.current[Key.LeftShift].isPressed)
#else #else
@@ -349,9 +348,7 @@ namespace Demo.Game
} }
} }
} }
#if UNITY_EDITOR
s_PreparePerfMarker.End(); s_PreparePerfMarker.End();
#endif
} }
public IEnumerator GameExit() public IEnumerator GameExit()

View File

@@ -647,8 +647,8 @@ namespace Demo
public void EnableScript(string sourcePath, string scriptPath, string scriptType, ScriptableObject parent) public void EnableScript(string sourcePath, string scriptPath, string scriptType, ScriptableObject parent)
{ {
#if UNITY_EDITOR #if UNITY_EDITOR||true
s_PreparePerfMarker = new(scriptPath); s_PreparePerfMarker = new(ScriptName);
#endif #endif
if (isEnableScript) if (isEnableScript)
{ {
@@ -705,7 +705,7 @@ namespace Demo
public string ScriptPath; public string ScriptPath;
public string ScriptTypename; public string ScriptTypename;
#if UNITY_EDITOR #if UNITY_EDITOR||true
public ProfilerMarker s_PreparePerfMarker; public ProfilerMarker s_PreparePerfMarker;
#endif #endif
public ScriptableObject Parent; public ScriptableObject Parent;
@@ -1129,7 +1129,7 @@ namespace Demo
return; return;
if (gameObject.activeInHierarchy == false) if (gameObject.activeInHierarchy == false)
return; return;
#if UNITY_EDITOR #if UNITY_EDITOR||true
s_PreparePerfMarker.Begin(this); s_PreparePerfMarker.Begin(this);
#endif #endif
if (tickType == TickType.Reset) if (tickType == TickType.Reset)
@@ -1148,7 +1148,7 @@ namespace Demo
{ {
child.ScriptUpdate(currentTime, deltaTime, tickType); child.ScriptUpdate(currentTime, deltaTime, tickType);
} }
#if UNITY_EDITOR #if UNITY_EDITOR||true
s_PreparePerfMarker.End(); s_PreparePerfMarker.End();
#endif #endif
} }

View File

@@ -960,7 +960,7 @@ PlayerSettings:
QNX: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING QNX: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING
Server: UNITY_VISUAL_SCRIPTING Server: UNITY_VISUAL_SCRIPTING
Stadia: UNITY_POST_PROCESSING_STACK_V2 Stadia: UNITY_POST_PROCESSING_STACK_V2
Standalone: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;PLATFORM_WINDOWS;DREAMTECK_SPLINES;UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING Standalone: ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;PLATFORM_WINDOWS;DREAMTECK_SPLINES;UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING;ENABLE_CLASS_Interaction
VisionOS: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING VisionOS: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING
WebGL: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING;DREAMTECK_SPLINES;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1 WebGL: UNITY_POST_PROCESSING_STACK_V2;UNITY_VISUAL_SCRIPTING;DREAMTECK_SPLINES;ODIN_VALIDATOR;ODIN_VALIDATOR_3_1;ODIN_INSPECTOR;ODIN_INSPECTOR_3;ODIN_INSPECTOR_3_1
Windows Store Apps: UNITY_VISUAL_SCRIPTING Windows Store Apps: UNITY_VISUAL_SCRIPTING