FreeMem

Hi.

Has anyone got the Arduino-MemoryFree to run?

I am using in my project a mkr1010, and after a while, the orange led starts blinking. I want to check if there is any memory leak, or something like that. But I can't go on with any MemAllocatin function I find in the Web.

Here, they say that the Arduino-MemoryFree works with SAMD21, but I could not get it work in my sketch.

Every time I call the freeRam() function, I got a compile error.

Arduino: 1.8.10 (Windows 10), Board: "Arduino MKR WiFi 1010"

C:\Program Files (x86)\Arduino\arduino-builder -dump-prefs -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\zampa\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\zampa\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\zampa\sketchbook\libraries -fqbn=arduino:samd:mkrwifi1010 -vid-pid=0X2341_0X8054 -ide-version=10810 -build-path C:\Users\zampa\AppData\Local\Temp\arduino_build_940807 -warnings=all -build-cache C:\Users\zampa\AppData\Local\Temp\arduino_cache_763117 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.bossac.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.bossac-1.7.0-arduino3.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.openocd.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.openocd-0.10.0-arduino7.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.CMSIS.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-Atmel.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -verbose C:\Users\zampa\sketchbook\mi_10_03_mqtt_230char_withMemCheck\mi_10_03_mqtt_230char_withMemCheck.ino
C:\Program Files (x86)\Arduino\arduino-builder -compile -logger=machine -hardware C:\Program Files (x86)\Arduino\hardware -hardware C:\Users\zampa\AppData\Local\Arduino15\packages -tools C:\Program Files (x86)\Arduino\tools-builder -tools C:\Program Files (x86)\Arduino\hardware\tools\avr -tools C:\Users\zampa\AppData\Local\Arduino15\packages -built-in-libraries C:\Program Files (x86)\Arduino\libraries -libraries C:\Users\zampa\sketchbook\libraries -fqbn=arduino:samd:mkrwifi1010 -vid-pid=0X2341_0X8054 -ide-version=10810 -build-path C:\Users\zampa\AppData\Local\Temp\arduino_build_940807 -warnings=all -build-cache C:\Users\zampa\AppData\Local\Temp\arduino_cache_763117 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.arduinoOTA.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.arduinoOTA-1.2.1.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arduinoOTA\1.2.1 -prefs=runtime.tools.bossac.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.bossac-1.7.0-arduino3.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0-arduino3 -prefs=runtime.tools.arm-none-eabi-gcc.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.arm-none-eabi-gcc-7-2017q4.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\arm-none-eabi-gcc\7-2017q4 -prefs=runtime.tools.openocd.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.openocd-0.10.0-arduino7.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7 -prefs=runtime.tools.CMSIS.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-4.5.0.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS\4.5.0 -prefs=runtime.tools.CMSIS-Atmel.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -prefs=runtime.tools.CMSIS-Atmel-1.2.0.path=C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\tools\CMSIS-Atmel\1.2.0 -verbose C:\Users\zampa\sketchbook\mi_10_03_mqtt_230char_withMemCheck\mi_10_03_mqtt_230char_withMemCheck.ino
Using board 'mkrwifi1010' from platform in folder: C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.4
Using core 'arduino' from platform in folder: C:\Users\zampa\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.4
Detecting libraries used...
"C:\\Users\\zampa\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\7-2017q4/bin/arm-none-eabi-g++" -mcpu=cortex-m0plus -mthumb -c -g -Os -w -std=gnu++11 -ffunction-sections -fdata-sections -fno-threadsafe-statics -nostdlib --param max-inline-insns-single=500 -fno-rtti -fno-exceptions -w -x c++ -E -CC -DF_CPU=48000000L -DARDUINO=10810 -DARDUINO_SAMD_MKRWIFI1010 -DARDUINO_ARCH_SAMD -DUSE_ARDUINO_MKR_PIN_LAYOUT -D__SAMD21G18A__ -DUSB_VID=0x2341 -DUSB_PID=0x8054 -DUSBCON "-DUSB_MANUFACTURER=\"Arduino LLC\"" "-DUSB_PRODUCT=\"Arduino MKR WiFi 1010\"" -DUSE_BQ24195L_PMIC "-IC:\\Users\\zampa\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Include/" "-IC:\\Users\\zampa\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS-Atmel\\1.2.0/CMSIS/Device/ATMEL/" "-IC:\\Users\\zampa\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.4\\cores\\arduino" "-IC:\\Users\\zampa\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.8.4\\variants\\mkrwifi1010" "C:\\Users\\zampa\\AppData\\Local\\Temp\\arduino_build_940807\\sketch\\mi_10_03_mqtt_230char_withMemCheck.ino.cpp" -o nul

The compile message is quite long, and exceeds the 9000char limit.

Please do this:

  • (In the Arduino IDE) click File > Preferences
  • Uncheck the box next to "Show verbose output during: > compilation
  • Click "OK"
  • Sketch > Verify/Compile
  • After the compilation fails you'll see a button on the right side of the orange bar "Copy error messages". Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the compilation output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the length of the output exceeds the forum's 9000 character limit, save it in a .txt file and post it here as an attachment. If you click the "Reply" button you'll see the "Attachments and other options" link.

Thanks!!!

Works perfectly. And after some hard reset of the mkr1010, the sketch works :slight_smile:

I close the thread!

My instructions were only meant to give use the information we need to troubleshoot the problem. I would never expect them to fix the problem. Well, I guess we can't complain too much if the error mysteriously fixed itself.

If the problem does come back, feel free to post the error here and we'll see if we can help out.

Hi.

Sorry, I expressed myself in a wrong way. I don't know why, but I was unable to load any code to the arduino. I followed your advice, how to shrink the error/warning list, and by the way I reseted (holding down the reset button) the arduino.

After that, the arduino works fine, and the free memory library works also fine.

Thanks anyway. I almost learned how to get the less compiler messages :slight_smile:

I would close the thread.

OK, I understand now. I'm glad to hear you found the real solution to the problem!

harutiun:
I followed your advice, how to shrink the error/warning list

I find that the verbose output during compilation is very rarely useful. The only time you really need it is when there is a problem caused by the Arduino IDE malfunctioning, which luckily is fairly rare. When the problem is an error in your sketch or a failure to upload, the verbose compilation output only clutters up the console and makes it more work to find the errors or warnings that really matter.

On the other hand, I find verbose output during upload very useful and I always leave that option checked.