Rewinder - when reallocating buffer, make sure we have released all references to the old buffer first to free up memory for the new buffer.

This commit is contained in:
jdpurcell 2015-01-18 00:56:32 +00:00
parent bcb6b20ec2
commit 423376835c
2 changed files with 6 additions and 3 deletions

View File

@ -235,12 +235,14 @@ namespace BizHawk.Client.Common
// if we have an appropriate buffer free, return it
if (_rewindBufferBacking != null)
{
var buf = _rewindBufferBacking;
_rewindBufferBacking = null;
if (buf.LongLength == size)
if (_rewindBufferBacking.LongLength == size)
{
var buf = _rewindBufferBacking;
_rewindBufferBacking = null;
return buf;
}
_rewindBufferBacking = null;
}
// otherwise, allocate it

View File

@ -65,6 +65,7 @@ namespace BizHawk.Client.Common
{
long capacity = 0;
_mBufferManage(_mAllocatedBuffer, ref capacity, false);
_mAllocatedBuffer = null;
}
}