public static void Main() { String tmp = ""; while (true) { Debug.Print("freemem : " + Debug.GC(true)); tmp = tmp + "0123456789"; } }
Debugger output:
freemem : 25284 freemem : 25272 freemem : 25260 freemem : 25248 freemem : 25248 freemem : 25236 freemem : 25224 #### Exception System.OutOfMemoryException - CLR_E_OUT_OF_MEMORY (1) #### #### Message: #### System.String::Concat [IP: 0000] #### #### NetduinoPlusApplication2.Program::Main [IP: 0020] #### A first chance exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll An unhandled exception of type 'System.OutOfMemoryException' occurred in mscorlib.dll
I suspect the firmware on mine is way out of date:
HalSystemInfo.halVersion: 4.1.2821.0 HalSystemInfo.halVendorInfo: Netduino Plus by Secret Labs LLC HalSystemInfo.oemCode: 34 HalSystemInfo.modelCode: 177 HalSystemInfo.skuCode: 4097 HalSystemInfo.moduleSerialNumber: 00000000000000000000000000000000 HalSystemInfo.systemSerialNumber: 0000000000000000 ClrInfo.clrVersion: 4.1.2821.0 ClrInfo.clrVendorInfo: Netduino Plus by Secret Labs LLC ClrInfo.targetFrameworkVersion: 4.1.2821.0 SolutionReleaseInfo.solutionVersion: 4.1.0.6 SolutionReleaseInfo.solutionVendorInfo: Netduino Plus by Secret Labs LLC SoftwareVersion.BuildDate: Feb 14 2011 SoftwareVersion.CompilerVersion: 400902
so I guess I have a few questions:
#1 - The error makes absolutely no sense - with 25kb free... Is this the same issue that I see in this thread ?
#2 - if a newer firmware would fix my issues - how do I download that? (I looked at the downloads section on the web site but didn't see anything there)
#3 - any suggestions or ideas on how to fix that? Workarounds? Anything?
What I saw in my other application is quite close - similar crash when the memory gets down to about 25-26kb. That leaves us with about 5-6kb of actual usable RAM ... does that sound right?
Is there any reserved amount of RAM that we should have in mind? (25kb out of 32k total sounds like quite a lot to be honest)