Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [memory-usage]

Use this tag for questions about memory usage on the Arduino.

0
votes
2answers
45 views

Memory problem? dtostr() and strcat()

I've been dealing with this for quite a while now and searching all over for answers.. I'm trying to put together two floats into a char*. Seperated by a ",". This is the code I'm working with. #...
0
votes
0answers
29 views

Radio tx/rx makes my oled screen not work

I've been struggeling with this assignment for school for a couple of days. I have finally figured out where the problem lies. I have an oled screen that is supposed to print out the temperature of a ...
0
votes
0answers
19 views

How can I fix a “MbedTLS error -17040” issue with my arduino code on ESP-32?

Despite several days of searching, I can't find any resources to check the MbedTLS error code "-17040". All of the error codes descriptions available are referencing only hex format errors (which the ...
1
vote
1answer
62 views

How can I reduce the memory usage on my code?

I wrote this code to control my christmas tree. It takes up the majority of the memory on my Arduino Uno: Sketch uses 31822 bytes (98%) of program storage space. Maximum is 32256 bytes. Global ...
1
vote
0answers
43 views

Storing an array of objects

I followed the instructions of this post: Storing an array of function pointers. To show my problem I shorted my code extremly but the problem is still there. My classes are defined as followes: ...
3
votes
4answers
135 views

Can you help me trim my code?

First of all I want to be clear, I'm not very skilled in programming methods, all the C I learned was for various Arduino projects. That being said, I just finished a project that reads some data ...
0
votes
1answer
114 views

Pointer memory allocation in function

I would like to know how Arduino allocate memory for pointers in function arguments. For instance. I have this code that use 192 bytes (Arduino IDE compiler: Global variables use 192 bytes (9%) of ...
0
votes
2answers
71 views

freeMemory() function from memoryfree library not returning decreased value in arduino UNO

I burned the code written below, I expect that as we declare the local variable in the loop, freeMemory() function should return decreased value. But it remains constant..! please explain why..? The ...
0
votes
1answer
20 views

MemoryFree library showing Irregular Behaviour..!

I simply burned the code written below but it is showing me irregular behaviour.. as in output's last paragraph, free memory increases after a runtime allocation, how it is possible? The output is ...
0
votes
0answers
34 views

MemoryFree library showing free memory more than capacity of Atmega328Pu MCU

I simply burned the code written below but it is showing me free memory as 2299 bytes please somebody clarify that how in an Atmega328pu can have 2299 bytes free with an overall capacity of 2048 bytes....
1
vote
2answers
145 views

Best practice to declare a 'static' text and save memory

I'm working on a project where I need to create a JSON to send back state of an object. I created the code to achieve it and all works fine, but I used this to declare the JSON fields: static const ...
1
vote
1answer
175 views

Sending >255 bytes array to arduino

I am trying to send a 50x50 bitmap bytearray from my python client to arduino where it should be displayed on a screen. I need to receive 350 bytes to have the data to show the bitmap but as soon as ...
0
votes
3answers
67 views

storage problem

I made a Arduino program to control my air conditioner(model:GREE Lomo) by PC. I download IRremote library from here for that. #include "IRremote.h" IRsend irsend; int irPin = 3; // pin IR led int ...
1
vote
1answer
24 views

Runtime Error when using array of structs of unknown size as variable within class - some kind of overflow issue?

I have a class defined as below, it's basically a simple ring buffer, with some methods for getting useful statistics from the data held in the buffer. enum BalanceMsgType{ BAL_MSG_NOT = 0, ...
0
votes
1answer
168 views

How to read main code inside main code in Arduino?

How can I read the hex code of the main programme stored inside flash memory inside my running Arduino programme? So far I am able to read the Flash at any given address by using PROGMEM unsigned ...
5
votes
3answers
943 views

When to use PROGMEM?

I believe PROGMEM is used to store large data (e.g. strings) that don't change. So it frees up the SRAM. in the Ardunio Reference it is mentioned that. "Using PROGMEM is also a two-step procedure. ...
6
votes
2answers
835 views

memory usage “dos and don'ts”

Though I've written C/C++ code for a long time, the unseen limitations on how memory was consumed on various MCU and SOC programming platforms have often tripped me up. As I'm about to build up code ...
2
votes
3answers
474 views

Reducing Memory Usage lots of Floats

Im using an Arduino Uno - All code at github.com/robbrad/AirQuality Current sketch usage: Sketch uses 23186 bytes (71%) of program storage space. Maximum is 32256 bytes. Global variables use 1428 ...
0
votes
2answers
63 views

What values are the Atmel MCUs EEPROMs preloaded with?

I have checked with two datasheets: one for some ATMegas and one for some ATTinys MCUs and could not find what the EEPROM.get() call would read back if the EEPROM was empty (or contained default ...
1
vote
2answers
663 views

Const data optimisation for Arduino

I'm taking a course on Arduino Uno programming and on today's talk I heard that the const data is optimized by Arduino, so that it occupies less space than the actual data type (namely, a const int ...
1
vote
3answers
319 views

Is it possible to configure FRAM memory for use as stack and heap?

I'm using the Adafruit I2C FRAM breakout board with my Nano and it works as advertised, but every time I write a variable to this thing I have to use library function calls with addressing. This makes ...
2
votes
2answers
167 views

Lowest memory consumption for arrays

I made a little joystick input recorder that stores the joystick state (8 directions + fire) and the time (how long was a button or direction pressed). Example data would be like this (i = input, t = ...
2
votes
1answer
4k views

String to persistent memory (EEPROM?)

I am creating a server node that I want to be able to save the wifi SSID and the password into persistent memory so that when it starts ups it can connect to the network. I have looked for several ...
0
votes
2answers
214 views

What are safe memory usage limits?

The Arduino IDE used to warn you when your sketch used too much memory. This warning now seems to have been removed. I compiled a sketch, and was surprised to see it use 175% of data memory...but not ...
0
votes
2answers
101 views

Is the use of malloc() and free() necessary in my Kalman noise Filter function?

I had a code that implements Kalman noise filtering on Arduino, and there is a use of malloc() and free(). I'm wondering if this will affect the Arduino or not (for example, the program will not ...
0
votes
3answers
238 views

Arduino constant vs Microchip PIC constant

2.2 THE BASICS OF C PROGRAMMING LANGUAGE book is has like this, CONSTANTS A constant is a number or a character having fixed value that cannot be changed during program execution. Unlike ...
0
votes
2answers
82 views

Sketch Memory in Pro

void storedata(File filename ,int type , String data) { if(type == 1){ Serial.println("Group Creation"); } //Storing Data into file pinMode(10, OUTPUT); if (!SD.begin(...
4
votes
1answer
103 views

Local variable usage in SRAM not counted

I use the following code to print the currently used SRAM space: // this function will return the number of bytes currently free in RAM // written by David A. Mellis // based on code by Rob Faludi ...
2
votes
2answers
2k views

Arduino String memory allocation

When a String variable is declared and modified inside a function, where does it go? To the heap(as string declaration is a part of dynamic memory allocation) or to the stack(as it is a part of ...
2
votes
1answer
794 views

Arduino Nano memory issue. SD card and LCD screen together

When i am uploading my code to arduino nano, i am getting message about high dynamic memory usage (87%): Sketch uses 17,628 bytes (57%) of program storage space. Maximum is 30,720 bytes. Global ...
0
votes
3answers
2k views

How to store 1 bit Boolean data into EEPROM and retrieve this 1 bit data?

I am building a project where I have to store the digital state which is Boolean (either HIGH or LOW) of each I/O port such that after power off the state of I/O ports store in EEPROM and I can ...
1
vote
1answer
5k views

Global variables use to much space in the dynamic memory

I use two simple libraries (see 1, 2) I found online for my code on the Arduino Uno, unfortunately I also use ROS and all those libraries take away to much space, when I compile my code I get this ...
0
votes
1answer
801 views

delete or free on object causes Arduino to hand or reboot

I've read a lot about dynamic allocation for strings or buffers, but that's not my case. I plan to implement much blinkers types as classes, all inheriting from a base Action class. I declare an ...
1
vote
1answer
1k views

Shrink array to save memory

In my project I need three arrays to store data inside. I define a maximal number of elements as a macro variable. However, at a certain point in the setup function, the program could determine, that ...
3
votes
3answers
1k views

Detailed analyse of memory usage

When compiling a sketch, after linking, the build outputs a kind of forecast on RAM usage, e.g.: Minimum Memory Usage: 1456 bytes (71% of a 2048 byte maximum) Is it possible to somehow get a ...
4
votes
1answer
9k views

int VS uint8_t VS uint16_t

This question is quite clear. What are the differences between an int, an uint8_t, and an uint16_t. I know it has to do with bytes and memory but can someone clarify me a bit? Things I want to know: ...
1
vote
2answers
1k views

Most memory efficient way to program

I currently know 3 ways to do a program. Which one of them is the most memory friendly. Note that the example code is simple (blinking a led) and the final code will be VERY VERY complex. Also, the ...
1
vote
0answers
214 views

Writing objects to PROGMEM

A few days ago I encountered memory problems (SRAM shortage) on my Arduino. I've read a lot and fixed the problem, now i have around 900 bytes free in SRAM. However, i still have difficulties ...
1
vote
1answer
188 views

Help avoiding floating point math

I'm using a Texas Instruments DRV2605 haptic controller in my project to drive a LRA vibration motor. I would like to calculate the LRA rated voltage during run time using the formula below as ...
3
votes
1answer
174 views

Question of proper usage for F Macro

Here are three use cases. Are all preferred or is the use of the F() macro pointless on some? 1. Serial.println(F("some string"); // definitely useful here 2. String str = F("some string"); Serial....
2
votes
2answers
80 views

Help with a Memory Issue

Below is some code that I'm writing to concurrently run "animations" on the same strip of NeoPixels. When I try to make use of the Serial monitor to control the program functions, I just get a bunch ...
0
votes
3answers
55 views

Array deletion problem

I am a bit confused about how memory works in Arduino. I have created an integer array like so: int* arr = new int[3] {1, 2, 3}; When I go to delete it: delete[] arr; The first element is deleted,...
2
votes
3answers
4k views

Storing an array of function pointers

I have some Arduino code that looks like: char packet = ser.read(); switch(packet){ case 'a': someobj.somefunc(); break; case 'b': otherobj.otherfunc(); ...
4
votes
1answer
280 views

Single #include pulls in all libraries

I am tracking down the memory usage of an Arduino-like project I am working on (not a real Arduino, but has same microcontroller and it uses the Arduino build environment, version 1.6.8). I have some ...
1
vote
3answers
2k views

Is there any way I can connect the RAM of a computer to Arduino?

I was thinking about a way to reuse the RAM of my old computer on my Arduino board. I was thinking about some peojects using neural networks, and more RAM would let the Arduino use more neurons. So ...
1
vote
1answer
645 views

Is the a low memory alternative to SoftwareSerial?

I'm running a program on a ATtiny85 and running into problems because of a lack of available RAM. When I ran avr-nm on my ELF file I found that SoftwareSerial was taking up a lot of RAM even though I'...
0
votes
2answers
162 views

Would rewriting my code in C help reduce RAM usage? [duplicate]

So my program fails to run because there is not enough room for my variables as well as the Arduino Core and Stack. I can't find any more ways to optimize my program so I'm thinking about just ...
3
votes
1answer
1k views

What is using up all the RAM in my program?

I am running a program on the ATtiny and for some reason I am way over the 512 bytes of RAM that are available to me. This is confusing because when I did the math by hand I should have 432 bytes. ...
4
votes
3answers
9k views

Can you access the EEPROM of an ATtiny with Arduino Code?

I'm attempting to reduce the amount of RAM being used by my program by writing some values to the EEPROM of my micro controller. I'm currently programming on the ATtiny85 which has 512 Bytes of EEPROM....
0
votes
2answers
79 views

I need more memory!

I am trying to make a RBB Arduino based project and I only need 3 pins. In the future I may use one to two more. I wanted to use an ATtiny85 however my code is 13,270 bytes and it would not fit. So I ...