๐ŸŽฎ Unity Study/Unity

[Unity] Garbage Collector

ibelieveinme 2023. 8. 21. 00:16
728x90

Resources.UnloadUnusedAssets();

GC.Collect();

 

 

https://jingonpark-gameclient.tistory.com/13

 

๋Œ€ํ‘œ์ ์ธ Memory leak ๋ฐœ์ƒ ์œ ํ˜•

Singleton static instance ๋”์ด์ƒ ์‚ฌ์šฉํ•˜์ง€ ์•Š๋Š” singleton๊ฐ์ฒด์˜ OnDestroy( )ํ•จ์ˆ˜์—์„œ ๋ฐ˜๋“œ์‹œ instance = null; ์ฒ˜๋ฆฌ๋ฅผ ํ•ด ์ฃผ์–ด์•ผ ํ•œ๋‹ค.๊ทธ๋ ‡์ง€ ์•Š์œผ๋ฉด OnDestroy( ) ์ดํ›„์—๋„ ๊ฐ์ฒด๋Š” ๊ณ„์†ํ•ด์„œ ์‚ด์•„์žˆ๋‹ค. OnDestroy( )ํ•จ

jingonpark-gameclient.tistory.com

 

728x90