feat: Adds an Item/Mobile memory leak detector. Fixes minor leak in doors. (#2159)
### Summary Adds the command [TrackLeaks to enable tracking item/mobiles that have been deleted but still have dangling references. Requires adding the _TRACK_LEAKS_ define constant during build.
This commit is contained in:
parent
1e349f4369
commit
4aa272d429
9 changed files with 256 additions and 9 deletions
|
|
@ -328,7 +328,7 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
public virtual TimeSpan DecayTime => DefaultDecayTime;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool Decays => Movable && Visible && Spawner == null;
|
||||
public virtual bool Decays => Movable && Visible && Spawner == null;
|
||||
|
||||
public DateTime LastMoved { get; set; }
|
||||
|
||||
|
|
@ -3268,6 +3268,13 @@ public class Item : IHued, IComparable<Item>, ISpawnable, IObjectPropertyListEnt
|
|||
}
|
||||
}
|
||||
|
||||
#if TRACK_LEAKS
|
||||
~Item()
|
||||
{
|
||||
EntityFinalizationTracker.NotifyFinalized(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
public virtual void OnDelete()
|
||||
{
|
||||
if (Spawner != null)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue