Skip to main content

Questions tagged [memory]

Use this tag for memory management or issues in programming.

Filter by
Sorted by
Tagged with
0 votes
1 answer
55 views

Problem with char* variable malloc/free. Empty contents on recipient variable after using free

I am working on a custom SD card data logger using the following function and struct: char *filenameCreator(const char *prefix, const char *num, bool addExtension) { char *filename = (char *)...
Daniel Melendrez's user avatar
0 votes
2 answers
145 views

Is std::string (and ephemeral memory allocation in general) safe to use for ESP32 Arduino?

I know that with 8-bit AVR Arduinos, std::string is widely regarded as fundamentally unsafe due to problems with heap-fragmentation (partly due to limited ram, and partly because the WAY the ...
Bitbang3r's user avatar
  • 543
1 vote
2 answers
106 views

Is there a maximum length of an array in ROM?

Consider the following code: #include <Arduino.h> unsigned char testimage [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ...
Bart Friederichs's user avatar
1 vote
1 answer
301 views

stream a "big" array of measures to a server through wifi

I'm measuring accelerations at "high frequency" (4kHz) from an accelerometer (ADXL355/ADXL357) to an esp32. It's crucial that no sample is lost while performing a measure which last say 2 ...
AlekseyFedorovich's user avatar
1 vote
1 answer
66 views

Where to store struct used for driver initialization

I'm doing a small project with ESP32 board. When initializing a driver, multiple structs are passed to initialization functions. I know that there are two ways to store such structs: Storing structs ...
Yiyang Yan's user avatar
1 vote
2 answers
156 views

What's Memory Allocation technique in Arduino

I am currently working on an assignment for my embedded systems course, and my professor has asked us to determine the memory allocation technique employed in Arduino. Specifically, I need to identify ...
Noran Hany's user avatar
3 votes
1 answer
3k views

ESP32 can not deep sleep longer than 35 minutes

I'm trying to get my Lilygo T5 4.7" epaper to deep sleep for 12 hours. But I only seem to be able to get about half an hour (2100s) of deepsleep on it. If I set the timer for longer, it just ...
Engberg's user avatar
  • 33
1 vote
1 answer
170 views

Conditional assignment of array

I have some really long global variable arrays filled with data. There is a single function that processes the data. The function works on only one array everytime. This arrays value changes every ...
user1584421's user avatar
  • 1,405
1 vote
1 answer
182 views

memory leak w/ no Strings involved

I'm trying to read data being transferred via Infrared from my Smartmeter on my ESP8266 using the following sketch: #include <ESP8266WiFi.h> #include <ESP8266WebServer.h> #include <...
1_am_r00t's user avatar
5 votes
2 answers
124 views

Not enough memory error using OneSheeld.h

I'm a dairy farmer and I'm new to playing around with Arduino's. I created a code to send me SMS's when my equipment stops working as it should, but I run into a "Not enough memory" error. ...
FarmerChuck's user avatar
0 votes
1 answer
71 views

Wrong use of memory?

Probably I'm doing something wrong. I'm writing an Arduino sketch for ESP32. Among the others I have this function: #define HDR_MAX_LENGHT 4 #define CMD_MAX_LENGHT 5 #define ARG_MAX_LENGHT 5 #define ...
Mark's user avatar
  • 393
0 votes
3 answers
49 views

How do you deal with balancing the limited storage of Arduino with the decrease in speed if you just print everything as it gets measured?

I am working on a simple data acquisition system based on an Arduino Uno. Each run would ideally collect up to 10k data points (all doubles). Obviously, the Arduino doesn't have the capacity to hold ...
Ben's user avatar
  • 101
1 vote
1 answer
330 views

1 global variable consuming 19% of memory

I am working on a simple project on talking to the serial monitor, and my only global variable ("int" type, named "incomingByte") is consuming a lot of memory. There is no problem ...
Vitor Z.'s user avatar
2 votes
1 answer
2k views

Space taken by Global Variables

Using Nano's for small programmes I get compilation reports about the amount of space taken by global variables. On a typical progamme it says something like Sketch uses 16316 bytes (53%) of program ...
Harry J Crowley's user avatar
-1 votes
1 answer
537 views

Is an ESP32 HTTP web server limited to a certain number of Base64 images?

This sketch only displays about nine images (when there are more). Does this mean the ESP32 is limited amount of Base64 images able to be displayed? #include <WiFi.h> #include <WebServer.h>...
adamaero's user avatar
  • 198
2 votes
1 answer
156 views

Can a power cut damage the software?

When unplugging the power source of a device that is writing some data "A" to an SD card, also other data "B" might get corrupted. (This is detailed here.) Regarding Arduino ...
root's user avatar
  • 123
2 votes
0 answers
89 views

Where to save time and other values so I can read them after arduino powered down?

I need to save some values (and be able to update them frequently) that will stay there even after powering down the Arduino. (I didn't specifically choose any board yet, but UNO or Mega will be ...
krystof18's user avatar
  • 315
1 vote
1 answer
182 views

I can change value of only one register on 8-Bit Register integrated circuit (74hc273 / DM74LS273)?

First, please be patient, I'm not electronical person. I am learning Arduino and electronics for hobby and this is my fist time with integrated circuits. Situation: I'm want to extend the Arduino ...
faanbece's user avatar
1 vote
1 answer
757 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 ...
gurkensaas's user avatar
9 votes
5 answers
2k views

Same structure taking different memory space on Uno and NodeMCU ESP8266, leading to data corruption when transferring via nRF24L01+

I'm trying to transfer data between a Arduino Uno board to a NodeMCU ESP8266 board, using nRF24L01+ transceivers module and RF24 library on both side. The data I'm transferring are stored in a struct ...
Vincent's user avatar
  • 232
1 vote
0 answers
626 views

Arduino Mega as a EEPROM Programmer for Winbond W29EE011 memories

I'm trying to use my Arduino Mega as an EEPROM memory writer. For this project, besides my Arduino Mega, I use an SD Card module, an LCD display and two push buttons to handle the events. Inside the ...
Dan Fayal's user avatar
1 vote
1 answer
1k views

nRF52 non-volatile storage/recall of a variable - is there a simple solution?

I have an Arduino program written for the nRF52 with which runs for a pre-set time-value (i.e. 2 minutes) before shuts off automatically. The variable time-value can be changed via BLE-write by the ...
TommyS's user avatar
  • 71
1 vote
1 answer
474 views

How to properly handle the Arduino String

I've read that the Arduino String is bad as it causes memory fragmentation, so I try to avoid them mostly. But I still have some occurences where I'm not quite sure if they are ok after all. The first ...
matthesinator's user avatar
0 votes
1 answer
110 views

Global array doesn't get assigned the space it would take up in memory

I have this sketch: const uint32_t len = 65536; uint8_t arr[len]; void setup() {} void loop() {} The length of the array should fit into the dynamic memory. However, when I compile the sketch it ...
LukasFun's user avatar
  • 295
1 vote
0 answers
89 views

Accessing start up bits of SRAM from MicroBit for PUF

https://infocenter.nordicsemi.com/pdf/nRF51822_PS_v3.4.pdf The aim is to extract (output in serial monitor) the start up bits from the SRAM of this microbit which is located at memory address ...
kepsek's user avatar
  • 11
2 votes
0 answers
564 views

How to adjust Partition Scheme Wemos D1 mini pro?

I bought myself a WEMOS D1 mini PRO (16MB) for creating a quite large project. As I'm writing code, my memory is starting to grow. When I looked at the Flash size in Arduino IDE, the only options I ...
Jens Vanhulst's user avatar
2 votes
4 answers
247 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 ...
Michel Keijzers's user avatar
1 vote
1 answer
2k views

converting an unsigned integer into a const char pointer

I know this is simple basic C stuff, but I can't quite figure it out or find a solution when searching and reading. I have a method I want to call from a library that wants a const char pointer ...
Chris Schmitz's user avatar
0 votes
1 answer
147 views

Is it possible for the Arduino's digital pin mode to flip from OUTPUT to INPUT unexpectedly?

I have an Arduino project (data logger intended to sample 100 samples per second for months) with firmware that is too long to post. It mostly works as supposed to, but I have a confusing issue I can'...
Vulcan's user avatar
  • 245
2 votes
1 answer
353 views

What happens when you call malloc()/free()/new/delete?

So I understand that generally speaking, dynamic allocation should be avoided. My question isn't how or why, but what happens when you call a function that allocates memory? On Windows or Linux, when ...
Dan Forever's user avatar
2 votes
2 answers
6k views

How to clear heap memory in ESP32?

I am using Free RTOS on ESP32 in my program. However at some point of time when I execute xTaskCreate() it returns -1 , the error being could_not_allocate_required_memory. In my program, each time I ...
Androing's user avatar
4 votes
1 answer
515 views

Does the compiled binary of a sketch include uncalled functions from a library?

I am writing a GUI using a TFT display and the Adafruit GFX library and its default font on Arduino Nano. I want to be memory efficient and I assumed that the 'optimise for size' default setting of ...
WildCat's user avatar
  • 323
-1 votes
2 answers
3k views

Arduino sketch uses too much memory storage space?

I've never used arduino before but am using one for a school project. I am using an arduino leonardo and I've uploaded the sample code below #include "Adafruit_CCS811.h" Adafruit_CCS811 ccs; ...
Screenwriter Marc's user avatar
1 vote
1 answer
1k views

Why isn't this EEPROM.get() working?

I am trying to save a string/char to EEPROM with EEPROM.put() and then get the value, but it doesn't work and I get a blank value when I do a EEPROM.get(). I remember this is how it worked on arduino ...
adrianTNT's user avatar
  • 252
1 vote
2 answers
84 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: ...
Arseni Mourzenko's user avatar
2 votes
1 answer
285 views

Connect SDRAM to STM32

Well, first of all hello to everything and thanks for reading my question. I am designing a board with STM32F730R8T6 MCU, and I want to connect MT48LC16M16A2P-6A to it which is 4MB SDRAM chip. The ...
Valentino Zaffrani's user avatar
0 votes
1 answer
500 views

External RAM (23LC1024) and external Flash (W25Q64JVSSIQ) with Sparkfun SAMD21

i'm trying to extend the capabilities of the Sparkfun SAMD21. My question is, which pins do I have to share? I mean, I understand that MISO, MOSI and SCK are shared, but CS connects each to a ...
Valentino Zaffrani's user avatar
1 vote
0 answers
283 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 ...
Nina's user avatar
  • 185
1 vote
0 answers
58 views

Having a bunch of global variables or calculate them on the go on an Arduino, as far as memory is concerned

So I'm new in the arduino world but I have a grasp of object oriented programming, and decided to write a little library for running games on an arduino mega using a display. My question is, I'm ...
Juan's user avatar
  • 11
2 votes
1 answer
402 views

Branchless programing on arduino?

So I've been looking into branchless programming to speed up code and I'm curious as to how exactly Arduino (or rather atmega328) actually reads machine instructions. Does it have a memory cache or ...
Beacon of Wierd's user avatar
0 votes
1 answer
84 views

If the code used for Arduino can be embedded into a permanent , callable memory, is there a way to create an OS for Arduino that runs on call?

This thought came into my mind on thinking about smartwatches. Although those I saw on YouTube are really good, they don't seem to provide a real experience of a real smartwatch - one that has an OS ...
Sam Ruben Abraham's user avatar
0 votes
1 answer
661 views

Connect two SD cards to one Arduino board and copy from one to another

I'm trying to connect 2 SD cards to an Arduino Uno board. My first question is: Is it possible to connect two SD cards to one Arduino simultaneously? The second question is: If it is possible to ...
user67463's user avatar
0 votes
1 answer
302 views

What does display.setSegments(&segto, 1, 1); do?

I am using a TM1637 display for my Arduino Uno. The goal was to just light up one point of the colon in the middle - what seems to be kind of impossible to accomplish. During research I stumbled over ...
data-research's user avatar
1 vote
1 answer
247 views

Junk values in EEPROM. while writing large values

Facing an issue while writing a large value (like 2000-5000) to EEPROM using EEPROM.put(). For example, While writing 2000 values to address 5 of EEPROM. Some junk values are written automatically to ...
Mayoogh Girish's user avatar
2 votes
1 answer
101 views

3-instruction remote machine coding Arduino Atmel chip over a serial line from a tethered (host) PC

I'm trying to write a program for AVR Atmel 328 chip on Arduino Nano board that will allow me to send machine code instructions to the chip over a serial line, run/execute them on the chip, and ...
Assad Ebrahim's user avatar
-1 votes
1 answer
318 views

EEPROM not consistent over reboot

I'am using a Wemos D1 mini V3.0.0 (esp 8266 core). I tried to save a structure in EEPROM memory but all data are lost when i reboot the board. I am using these basics functions : int cle_verif = ...
Marco Bresson's user avatar
1 vote
2 answers
3k 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 ...
NickG's user avatar
  • 163
0 votes
3 answers
4k views

How to fix memory-leak code in ESP8266/NodeMCU caused by string concenation?

I have following code in loop() in NodeMCU. This part is before setup(): String serial_data_read = ""; // for incoming serial string data String serial_data = ""; // for incoming serial string ...
Frodik's user avatar
  • 127
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 ...
Casey's user avatar
  • 151
2 votes
1 answer
242 views

Arduino Nano IoT 33 Char Array size constraints

I would like to save data that I am receiving from API calls in a char array. The problem is that the data is around 80 kB, and my Arduino IoT 33 only has 32 kB of memory. It will save data in a char ...
Amir's user avatar
  • 31