From 0ca93f35ba988299ba73aa4726b392b9c4b3a82d Mon Sep 17 00:00:00 2001 From: jdpurcell Date: Mon, 19 Jan 2015 19:48:04 +0000 Subject: [PATCH] Rewinder - small fix to memory allocation limit. --- BizHawk.Client.Common/rewind/Rewinder.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/BizHawk.Client.Common/rewind/Rewinder.cs b/BizHawk.Client.Common/rewind/Rewinder.cs index 72cfbae791..438b2a44c8 100644 --- a/BizHawk.Client.Common/rewind/Rewinder.cs +++ b/BizHawk.Client.Common/rewind/Rewinder.cs @@ -221,10 +221,11 @@ namespace BizHawk.Client.Common { if (allocate) { - if (size > Int32.MaxValue) + const int MaxByteArraySize = 0x7FFFFFC7; + if (size > MaxByteArraySize) { - // I think we need .NET 4.5+ on x64 to allocate > 2GB - size = Int32.MaxValue; + // .NET won't let us allocate more than this in one array + size = MaxByteArraySize; } if (_overrideMemoryLimit != null)