Questions tagged [memory-usage]

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

Filter by
Sorted by
Tagged with
4
votes
2answers
134 views

Is there a way to add external RAM (let's say 100 MB or 200 MB) in this audio buffer mixing context?

I'm coding a music sampler device: for fast playback / minimal latency (only a few milliseconds), it's better to have all audio .wav samples we want to use in RAM, so that when some of them are ...
1
vote
1answer
41 views

Why the global variables info is not shown for Arduino Due in IDE?

If I compile a sketch for the Arduino Mega: Sketch uses 1804 bytes (0%) of program storage space. Maximum is 253952 bytes. Global variables use 188 bytes (2%) of dynamic memory, leaving 8004 bytes ...
0
votes
1answer
27 views

Is low memory warning based on a fixed number of on the actual sketch?

I have the following output of my sketch for the Arduino Mega so far: Sketch uses 25020 bytes (9%) of program storage space. Maximum is 253952 bytes. Global variables use 6919 bytes (84%) of dynamic ...
0
votes
2answers
33 views

Timestamping AnalogBinLogger data

I would like to timestamp the data collected from AnalogBinLogger.ino on an Arduino Uno. The sketch uses 512-byte buffers, and I have read that writing data in 512-byte chunks is 'better' in terms of ...
0
votes
1answer
54 views

Memory usage in AnalogBinLogger of SdFat library

The AnalogBinLogger.ino file of SdFat library says the following: Each 512 byte data block in the file has a four byte header followed by up to 508 bytes of data. (508 values in 8-bit mode or 254 ...
1
vote
1answer
30 views

Maximum Capacity Debugging

1. Example Check the program below for an Arduino Nano, Old Bootloader, for variable values of N. For low values (N<=1857), the program outputs "[FFFFFFFF]", For higher values (1858<=N<=...
0
votes
1answer
32 views

Dynamic memory 'new' (of an overridden class) call affects SRAM memory

I have made a quite large program (not executed at an Arduino lately). However, if I compile with the next fragment: void LightSetupClass::CreateFixtures() { for (fixture_number_t fixtureNumber =...
1
vote
2answers
51 views

Is new without a delete acceptable?

I know it is not a good practice to use the new command to dynamically create data, however, if I would never use the delete, would it result in memory gaps/other problems? Background The reason I ...
1
vote
1answer
24 views

Is new.cpp programmed improperly? Arduino 1.8.9

I'm having trouble with my code and I'm not sure if it's a memory allocation issue. So I look at the new, delete to see if it throws errors, and finding the source code I find outrageously simple ...
4
votes
3answers
1k views

Memory usage: #define vs. static const for uint8_t

I'm writing an Arduino library to communicate with an I2C device, and I'm wondering what the best way is to declare all the register addresses so as to save memory. Using #defines: #define ...
0
votes
0answers
66 views

Problem with variables

I have a simple Low pass filter in my program that stops working after some time (Let say 4 hours or more). 'CRate' is a double type variable between -20 and 100. uint8_t T_Sample=10; double FCR0=...
2
votes
1answer
548 views

I need help with U8GLIB library

I have a project which uses a 128x64 oled display. I have to use the U8GLIB as the available displays change from SSD1306 to SSH1106 depending on when you buy it which that library covers both ...
1
vote
2answers
115 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*. Separated by a ",". This is the code I'm working with. #...
0
votes
0answers
54 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
56 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
330 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
81 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 extremely but the problem is still there. My classes are defined as followes: ...
3
votes
4answers
189 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
307 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
241 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
36 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 ...
1
vote
2answers
593 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 ...
2
votes
1answer
317 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
74 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
34 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
177 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
2k 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. ...
7
votes
2answers
1k 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
577 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
73 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
1k 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
431 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
275 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
6k 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
350 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
129 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
571 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
88 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(...
3
votes
1answer
115 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
3k 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
1k 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
3k 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
2answers
7k 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
1k 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
2k 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 ...
4
votes
3answers
2k 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 ...
5
votes
1answer
14k 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
2k 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
302 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
217 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 ...