well its not that simple. normally i would check to see if what i tried to allocate failed with a null pointer, and display an error. but the project I'm doing is a Simon type game that reverses the order. I'm also attempting to write my own header files. since the only i/o was a simple leds and button... how should could i deal with the memory issue if it happens?
Assume there won't be a problem.
By a new microprocessor if the existing one fails.
Lives are not at risk.
...R
Don't allocate memory - the arduino has very little ram. Decide how much you'll need up front and declare it statically.
Ahhh ...
I thought the title meant that the OP wanted to detect when a memory cell would no longer reliably hold data.
...R
normally i would check to see if what i tried to allocate failed with a null pointer, and display an error.
Please read this: Arduino Memories | Memories of an Arduino | Adafruit Learning System
Install 1.5.6r2 and you will have that answer every time you press the "check mark" to build.
If you are on 1.0.x then you can do a compile, go to the temp directory where the files were built, locate the .ELF file and user the AVR utility program: AVR-SIZE -C
Windows:
PATH=%path%;C:\Program Files\Arduino_105\hardware\tools\avr\utils\bin;
CD %TEMP%
MD %PUBLIC%\ELFtemp
for /R %TEMP% %%f in (*.elf) do XCOPY /D /Y %%f %PUBLIC%\ELFtemp\
DIR %PUBLIC%\ELFtemp\*.elf /s /b /O:-D /T:W >ElfRhere
SET /P ELF= <ElfRhere
ECHO %ELF% >MemUsage.txt
AVR-SIZE -C %ELF% >>MemUsage.txt
NOTEPAD MemUsage.txt
SET ELF=""
Explanations and other platforms here:
Details here: AVR SRAM Usage Script (Windows) - Exhibition / Gallery - Arduino Forum