Unity-memória és szemétgyűjtés
Jeleneteken, asseteken és objektumélettartamon át követi a Unity memóriahasználatát. Elkülöníti az átmeneti foglalást a bent maradó erőforrástól, hogy a javítás a valódi felelőst érje.
unity-game-memory-gc
Nézd meg, miben segítMikor hasznos?
Akkor használd, ha ismételt pálya, pool vagy aszinkron munka objektumot tart meg, és a memória nem áll vissza.
Miben segít neked?
- Elkülöníti a kezelt foglalást a natív és erőforrás-tulajdontól.
- Azonos jelenetéletciklus-pontokon hasonlít pillanatképeket.
- Korlátozza a poolt, követi a megmaradt hivatkozást, eseményt és aszinkron munkát.
Például ezt kérheted
Vizsgálj meg egy Unity-játékot, amely minden kazamatalátogatás után több memóriát használ. Belépés előtt és távozás után azonos állapotban készíts mintát, majd keresd a bent maradó textúrákat, eseményfigyelőket és ellenfeleket. Célzott javítás után ismételj több látogatást; a memória stabilizálódjon, harc közbeni foglalási tüskék nélkül.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Memory Lifetime and Garbage Collection
Record Unity version, scripting backend, target memory budget and a representative load/play/unload sequence. Distinguish managed heap, native objects, texture/mesh/audio residency and reserved versus committed/resident memory.
- Attribute allocation sites and collection spikes; GC.Alloc sample duration is not the full later collection cost. Avoid treating every allocation outside a hot path as a defect.
- Compare memory snapshots at equivalent lifecycle points and inspect retainers/ownership. Repeated scene loads or pooled reuse should return to a justified steady state.
- Keep pools bounded and reset references, callbacks and async work. Pooling can reduce churn while retaining too much memory; measure both effects.
- Release resources through the APIs of their actual ownership system: Unity objects, NativeContainers, Addressables handles and external buffers have different contracts.
- Investigate event subscriptions, static collections, async continuations and domain-reload-disabled state before forcing collections or unloading assets globally.
- Use supported Memory Profiler and allocation tools and label Editor/player differences. Preserve serialized and gameplay state while changing lifetime.
Check repeated open/close, scene unload, death/respawn, pool growth and cancellation under representative load. Report bytes, ownership evidence and actual target conditions.
Reference: Unity memory management, using the installed Editor version.
Csomagban lévő fájlok 2
LICENSE.txtSKILL.md
