Fix memory leak from object pools.
This commit is contained in:
@@ -524,6 +524,8 @@ namespace Cryville.Crtr {
|
|||||||
Game.AudioClient.Start();
|
Game.AudioClient.Start();
|
||||||
Game.AudioSession = Game.AudioSequencer.NewSession();
|
Game.AudioSession = Game.AudioSequencer.NewSession();
|
||||||
inputProxy.Deactivate();
|
inputProxy.Deactivate();
|
||||||
|
inputProxy = null;
|
||||||
|
judge = null;
|
||||||
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
if (nbus != null) { nbus.Dispose(); nbus = null; }
|
||||||
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
if (tbus != null) { tbus.Dispose(); tbus = null; }
|
||||||
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
if (bbus != null) { bbus.Dispose(); bbus = null; }
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (s.CloneType == 2) SetGraphicalActive(false, s);
|
if (s.CloneType == 2) SetGraphicalActive(false, s);
|
||||||
else SetPreGraphicalActive(false, s);
|
else SetPreGraphicalActive(false, s);
|
||||||
}
|
}
|
||||||
anchorEvPool.Return(tev);
|
ReturnAnchorEvent(tev);
|
||||||
}
|
}
|
||||||
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 2);
|
else if (RootTransform && s.CloneType == 2) MatchDynamic(s, 2);
|
||||||
}
|
}
|
||||||
@@ -245,9 +245,14 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
public virtual void Discard(ContainerState s, StampedEvent ev) {
|
||||||
if (ev is StampedEvent.Anchor) {
|
if (ev is StampedEvent.Anchor) {
|
||||||
anchorEvPool.Return((StampedEvent.Anchor)ev);
|
ReturnAnchorEvent((StampedEvent.Anchor)ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void ReturnAnchorEvent(StampedEvent.Anchor ev) {
|
||||||
|
ev.Container = null;
|
||||||
|
ev.Target = null;
|
||||||
|
anchorEvPool.Return(ev);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -321,10 +321,10 @@ namespace Cryville.Crtr.Event {
|
|||||||
public void Discard(StampedEvent ev) {
|
public void Discard(StampedEvent ev) {
|
||||||
Handler.Discard(this, ev);
|
Handler.Discard(this, ev);
|
||||||
if (ev is StampedEvent.RelativeMotion) {
|
if (ev is StampedEvent.RelativeMotion) {
|
||||||
relmEvPool.Return((StampedEvent.RelativeMotion)ev);
|
ReturnRelativeMotionEvent((StampedEvent.RelativeMotion)ev);
|
||||||
}
|
}
|
||||||
else if (ev.Origin is StampedEvent.RelativeMotion) {
|
else if (ev.Origin is StampedEvent.RelativeMotion) {
|
||||||
erelmEvPool.Return((StampedEvent.Temporary)ev);
|
ReturnEndRelativeMotionEvent((StampedEvent.Temporary)ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ namespace Cryville.Crtr.Event {
|
|||||||
if (ev.Duration == 0) {
|
if (ev.Duration == 0) {
|
||||||
PlayingMotions.Remove(ev);
|
PlayingMotions.Remove(ev);
|
||||||
_rmvpa.Return(mv);
|
_rmvpa.Return(mv);
|
||||||
relmEvPool.Return(tev);
|
ReturnRelativeMotionEvent(tev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (ev.Unstamped is EventContainer) {
|
else if (ev.Unstamped is EventContainer) {
|
||||||
@@ -372,8 +372,8 @@ namespace Cryville.Crtr.Event {
|
|||||||
var mv = PlayingMotions[oev];
|
var mv = PlayingMotions[oev];
|
||||||
if (mv.CloneTypeFlag == CloneType) _rmvpa.Return(mv);
|
if (mv.CloneTypeFlag == CloneType) _rmvpa.Return(mv);
|
||||||
PlayingMotions.Remove(oev);
|
PlayingMotions.Remove(oev);
|
||||||
erelmEvPool.Return((StampedEvent.Temporary)ev);
|
ReturnEndRelativeMotionEvent((StampedEvent.Temporary)ev);
|
||||||
relmEvPool.Return((StampedEvent.RelativeMotion)oev);
|
ReturnRelativeMotionEvent((StampedEvent.RelativeMotion)oev);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
var nev = oev.Unstamped;
|
var nev = oev.Unstamped;
|
||||||
@@ -521,7 +521,6 @@ namespace Cryville.Crtr.Event {
|
|||||||
ev.Container = Container;
|
ev.Container = Container;
|
||||||
ev.Name = m.Key;
|
ev.Name = m.Key;
|
||||||
ev.Node = node.Value;
|
ev.Node = node.Value;
|
||||||
ev.ReleaseEvent = null;
|
|
||||||
bus.PushTempEvent(ev);
|
bus.PushTempEvent(ev);
|
||||||
if (node.Value.EndTime.Value > node.Value.Time.Value) {
|
if (node.Value.EndTime.Value > node.Value.Time.Value) {
|
||||||
var eev = erelmEvPool.Rent();
|
var eev = erelmEvPool.Rent();
|
||||||
@@ -534,6 +533,17 @@ namespace Cryville.Crtr.Event {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void ReturnRelativeMotionEvent(StampedEvent.RelativeMotion ev) {
|
||||||
|
ev.Container = null;
|
||||||
|
ev.Node = null;
|
||||||
|
ev.ReleaseEvent = null;
|
||||||
|
relmEvPool.Return(ev);
|
||||||
|
}
|
||||||
|
void ReturnEndRelativeMotionEvent(StampedEvent.Temporary ev) {
|
||||||
|
ev.Container = null;
|
||||||
|
ev.Origin = null;
|
||||||
|
erelmEvPool.Return(ev);
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ namespace Cryville.Crtr {
|
|||||||
readonly IntKeyedDictionary<PropSrc>[] ContextCascade = new IntKeyedDictionary<PropSrc>[256];
|
readonly IntKeyedDictionary<PropSrc>[] ContextCascade = new IntKeyedDictionary<PropSrc>[256];
|
||||||
int _cascadeHeight;
|
int _cascadeHeight;
|
||||||
public void ContextCascadeInsert() {
|
public void ContextCascadeInsert() {
|
||||||
ContextCascade[_cascadeHeight++].Clear();
|
_cascadeHeight++;
|
||||||
}
|
}
|
||||||
public void ContextCascadeInsert(IntKeyedDictionary<PropSrc> srcs) {
|
public void ContextCascadeInsert(IntKeyedDictionary<PropSrc> srcs) {
|
||||||
ContextCascadeInsert();
|
ContextCascadeInsert();
|
||||||
@@ -143,7 +143,7 @@ namespace Cryville.Crtr {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
public void ContextCascadeDiscard() {
|
public void ContextCascadeDiscard() {
|
||||||
--_cascadeHeight;
|
ContextCascade[--_cascadeHeight].Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PdtEvaluator() {
|
public PdtEvaluator() {
|
||||||
|
|||||||
Reference in New Issue
Block a user