I don’t think we are getting our question answered.
There seems to be an understanding that we are asking about memory during the running of the program. In my case at least I completely understand dynamic memory and memory managers, etc. I have designed and written them. RAM memory, not the flash. I understand that every time I create an instance of anything some RAM is used and that when I dispose of the instance the RAM is freed for use elsewhere. I think the answers we are getting is explaining this.
My question( and I think chillydl147’s ) is about only the instant in time when our ProgramStarted routine is called
To clarify my question I created from scratch a new CerbuinoBee Gadgeteer program. I added a print, sleep loop.
I linked an ENC28Ethernet module and two Header modules to the sockets in the diagram tool.
I did not add anything else or change anything. I ran it.
Attached is the source and the output. I am assuming that this number printed out is the memory available. Given that the spec says the CerbuinoBee has > 100k of RAM available, but my print statement indicates that there is only about 40K available when my code starts (and ~5K released a few seconds later), the question is:
Is there any way to find out where the other approximately 60K is going and if there is any way to reduce it.
using System;
using System.Collections;
using System.Threading;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;
using Microsoft.SPOT.Presentation.Shapes;
using Microsoft.SPOT.Touch;
using Gadgeteer.Networking;
using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;
using Gadgeteer.Modules.GHIElectronics;
namespace Test
{
public partial class Program
{
// This method is run when the mainboard is powered up or reset.
void ProgramStarted()
{
/*******************************************************************************************
Modules added in the Program.gadgeteer designer view are used by typing
their name followed by a period, e.g. button. or camera.
Many modules generate useful events. Type +=<tab><tab> to add a handler to an event, e.g.:
button.ButtonPressed +=<tab><tab>
If you want to do something periodically, use a GT.Timer and handle its Tick event, e.g.:
GT.Timer timer = new GT.Timer(1000); // every second (1000ms)
timer.Tick +=<tab><tab>
timer.Start();
*******************************************************************************************/
// Use Debug.Print to show messages in Visual Studio's "Output" window during debugging.
Debug.Print("Program Started");
for (int i = 0; i < 20; i++)
{
Debug.Print(Debug.GC(true).ToString());
Thread.Sleep(10000);
}
}
}
}
And the output (complete with messages about doing too much in the init thread):
[quote]Using mainboard GHI Electronics FEZ Cerbuino Bee version 1.2
Program Started
40176
WARN: Total initialization time exceeds 10 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 20 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 30 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 40 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 50 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 60 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 70 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 80 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 90 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 100 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 110 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 120 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 130 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 140 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 150 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 160 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 170 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 180 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 190 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
45744
WARN: Total initialization time exceeds 200 seconds.
: ProgramStarted is blocking execution, which means events and timers will not run properly.
: Make sure not to use blocking code such as while(true) - use a GT.Timer instead.
The thread ‘’ (0x4) has exited with code 0 (0x0).[/quote]