Fix Little Memory Leaks

This commit is contained in:
copecone committed 2026-05-27 15:44:55 +09:00
1 parent 9454226306
commit 42741c2cb2
2 files changed
+18 -1

No files matched your search

+12 -1
View File
@@ -22,7 +22,8 @@ namespace ADOFAIRenderer.Component
private static GameObject? _debugMonitorObj; private static GameObject? _debugMonitorObj;
private static GameObject? _escapeHandlerObj; private static GameObject? _escapeHandlerObj;
private static string? _currentOutPath; private static string? _currentOutPath;
private static bool _isRenderCancelled = false;
public static RenderSettings Configuration; public static RenderSettings Configuration;
public struct RenderSettings public struct RenderSettings
@@ -291,6 +292,11 @@ namespace ADOFAIRenderer.Component
continue; continue;
} }
if (_isRenderCancelled)
{
break;
}
if (EndRequested) if (EndRequested)
{ {
bool hasMore; bool hasMore;
@@ -319,6 +325,8 @@ namespace ADOFAIRenderer.Component
public void CancelRender() public void CancelRender()
{ {
RenderMod.IsRendering = RenderMod.IsCapturing = false; RenderMod.IsRendering = RenderMod.IsCapturing = false;
_isRenderCancelled = true;
StopFFmpeg(false); StopFFmpeg(false);
EndRender(); EndRender();
} }
@@ -353,6 +361,8 @@ namespace ADOFAIRenderer.Component
} }
ImageQueue.Clear(); ImageQueue.Clear();
} }
RenderMod.FrameReader?.Dispose();
// 디버그 모니터 UI 정리 // 디버그 모니터 UI 정리
if (_debugMonitorObj) if (_debugMonitorObj)
@@ -423,6 +433,7 @@ namespace ADOFAIRenderer.Component
GCS.customLevelPaths = null; GCS.customLevelPaths = null;
GCS.customLevelId = null; GCS.customLevelId = null;
RenderMod.FrameReader?.Dispose();
ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnEditor"); ADOBase.loader.LoadSceneWithTransition(WipeDirection.StartsFromRight, "scnEditor");
} }
} }
+6
View File
@@ -104,6 +104,12 @@ namespace ADOFAIRenderer.Util
private void RecycleState(ReadbackRequestState state) private void RecycleState(ReadbackRequestState state)
{ {
if (!_isInitialized)
{
state.Dispose();
return;
}
state.Recycle(); state.Recycle();
lock (_poolLock) lock (_poolLock)
{ {