Questions tagged [memory-usage]
Use this tag for questions about memory usage on the Arduino.
148 questions
1
vote
0
answers
117
views
"Stack canary watchpoint triggered (loopTask)" when synchronizing with Arduino Cloud IoT (ArduinoCloud.update())
I have created a sketch that updates 195 variables : 16xString variables, 34xfloat, 52xint, 107xbool.
Notice : I'm using the IDE tool instead of the included Cloud IoT compile (because I have a pb ...
0
votes
1
answer
89
views
How can I make this function take up less memory? [duplicate]
I've written a sketch that uses TimeLib to display elapsed time. I'm measuring how long it takes to drain a battery. The goal is to display the time as hh:mm:ss.
The code I use works well when I ...
0
votes
1
answer
196
views
deserializeJson() failed: NoMemory when sending Serial json using ArduinoJson
Hey all I have a sketch that takes up 99% of my storage space since I am using a Arduino Nano.
Although everything in my code fits as-is, there seems to be an issue with me sending a json string over ...
0
votes
2
answers
132
views
Is it "safe" to use "new" keyword to instantize several sensor objects?
I've read that it is bad practice to use dynamic memory allocations on a microcontroller and I have a pretty good grasp of why.
I am developing a custom PCB around an ATMega2560 and in my situation, I ...
1
vote
1
answer
356
views
Why does Serial.print(1) cost 228 bytes more program memory compared to Serial.print((char)(48+1))?
Just discovered this. When I cast an int to a char inside a Serial.print statement it costs way less program memory. I'm not sure why. Could someone explain this to me?
In the following example the ...
-3
votes
1
answer
102
views
Which Arduino board would be sufficient for the following simulink project?
I'm trying to run a Fuzzy Logic MPPT Algorithm in Arduino UNO, here's the Simulink File
However when I try to upload the code, I get the following error
Is this project possible with UNO, if yes, ...
1
vote
0
answers
363
views
Save data permanently on ESP32
I'm working on a stage (this is my first bigger Arduino project), and I want to create an initializer for it, and for this, I want to store some variables in the memory of ESP32 WROVER-B. For this, I ...
3
votes
2
answers
915
views
5V alternative to Due?
I've designed a circuit controlled by an Arduino Mega 2560 involving a number of external components all running on and sending out 5V signals. I'm now realizing that the 8Kb of SRAM on the Mega 2560 ...
1
vote
1
answer
1k
views
Read bytes from PROGMEM array
Disclaimer: I just started using C++ and I'm a bit of a beginner. Keep that in mind as your answering.
So I recently bought my first Arduino. It's a customized one and it has an 8x8 display attached ...
3
votes
3
answers
950
views
Request for help condensing code and saving memory
I'm building a final project for a class that involves playing an audio file of a wave shield every time I scan an amiibo with an RFID scanner. I'm a pretty new programmer, so I'm not very familiar ...
1
vote
1
answer
300
views
How do I get the size of my program at runtime?
(This question is specific for the Arduino Due, but maybe there's a general answer to the question)
I'm using DueFlashStorage to store application data in the flash memory of my Arduino Due. That ...
2
votes
4
answers
331
views
What would be the best way of dynamically 'change' instances regarding dynamic memory?
Since I'm very used to object oriented programming, I would like to use this into my design.
My application will have 4 led strips and each led strip will have a 'pattern' running on it. For this I ...
3
votes
2
answers
681
views
Memory allocation on Arduino Due never returns NULL
I'm working on a project that uses quite a bit of RAM to store and analyze data that is sent from the PC. The program heavily relies on malloc/free, which normally works just fine. However, if the ...
4
votes
1
answer
984
views
ATTiny13 Interrupt Issue
I have recently been working on a project that I had initially been designing with an Arduino Nano, and I was able to create functioning code for my application, but for cost / space reduction I ...
1
vote
2
answers
101
views
What happens, memory-wise, when I call a function from another function?
I'm inspecting where the memory is used in an application which runs on Arduino. To my surprise, there are several locations where 100 to 200 bytes are consumed by simply calling a function. Example:
...
1
vote
0
answers
316
views
ESP8266 NodeMCU running out of heap
I'm trying to create SMS alarm using Twilio, Firebase and Arduino IDE. Using sensors I am measuring the temperature. If the temperature is higher than a specified value (ESP reads that value from ...
0
votes
1
answer
538
views
Erasing 1 byte of external Flash memory (winbond)
i'm trying to use an external flash memory Winbond 25q64jvsiq for my Arduino Nano based project for audio recording purposes, to have extra memory for recording 1 byte audio samples, since Arduino ...
1
vote
0
answers
524
views
Understanding heap fragmentation
I finally understand why people do not allocate memory when it comes to micro-controllers. The reason is because as you allocate different objects on the heap of various sizes and then you delete them ...
0
votes
1
answer
601
views
Is it required to delete variables before going to sleep?
This tutorial shows how to put the arduino to sleep and use a watchdog to wake up at intervals:
https://youtu.be/urLSDi7SD8M
I been studding c++ and as I am getting better I am instantiating objects ...
-3
votes
1
answer
2k
views
Any limitation on array size in Arduino Mega 2560?
I am writing an Arduino code with 3 arrays.
Two of those are double and other one is int. Further first two arrays have nearly 420 elements for each.
Now I noticed that with more that 89 elements on ...
8
votes
4
answers
4k
views
What are the traditional ways to optimize program memory usage?
While doing big projects using Arduino boards (Uno, Atmega328P MCU). I used to get warnings like this
Sketch uses 13764 bytes (44%) of program storage space. Maximum is 30720 bytes.
Global variables ...
1
vote
2
answers
4k
views
Serial printing from flash memory (F() macro, PROGMEM, sprintf_P, SPTR)
I have been testing various techniques on an Arduino Uno for serial printing from flash memory instead of RAM. At the same time, I have been using the freeMemory() function from Adafruit.
I created a ...
5
votes
4
answers
1k
views
How can a function/method determine if a const array passed in is PROGMEM (flash) or not (RAM)?
Is it possible for a function/method to know if a constant array that has been passed in is in flash or RAM?
If I have a method or function that receives a constant array that is in RAM, the array is ...
1
vote
2
answers
109
views
Gratuitious instantiation of `Serial`, why?
Let's take a very simple sketch, any simple one-.ino sketch. Say, just a led blinker like this
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop()
{
...
1
vote
1
answer
838
views
Reduce Sketch Size Help!
I dont know what to do?
Sketch uses 3712 bytes (12%) of program storage space. Maximum is 30720 bytes.
Global variables use 210 bytes (10%) of dynamic memory, leaving 1838 bytes for local variables. ...