Skip to main content

Questions tagged [memory]

Use this tag for memory management or issues in programming.

Filter by
Sorted by
Tagged with
10 votes
1 answer
37k 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: ...
Dat Ha's user avatar
  • 2,913
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
7 votes
3 answers
16k views

How much code can an Arduino board run?

I'm getting back up and running with microcontrollers after about 5 years of hibernation time, and I am trying to understand a lot of different things. I have been experimenting with Arduinos for the ...
Listen's user avatar
  • 85
7 votes
4 answers
27k 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....
Isabel Alphonse's user avatar
6 votes
3 answers
8k 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 ...
goddland_16's user avatar
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
5 votes
3 answers
6k 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. ...
Praveen Singh Yadav'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
5 votes
3 answers
4k views

External Flash Memory File System

I'm building a weather data collector and I want to be able to dump that weather data somewhere. I've considered the options, and since I'm going to be storing a fairly small amount of data (in the ...
Carrot M's user avatar
4 votes
3 answers
8k views

Spiffs vs Eeprom on esp8266

In my project, i have some data to save permanently. After some research i got many examples and informations to do that with eeprom. I used it effectively. After all i decide to deep dive to esp8266 ...
Dogan Cignakli's user avatar
4 votes
2 answers
1k views

Locally declared variable takes up global variable space in dynamic memory/SRAM

I'm trying to make my Arduino Uno control the air conditioner by recording the raw IR signal of several of the AC remotes temperatures using AnalysisIR. However these IR codes are quite long (array ...
ihish52's user avatar
  • 41
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
4 votes
3 answers
6k 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 ...
SrJaimito's user avatar
  • 141
4 votes
2 answers
2k 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'...
Angel Lockhart's user avatar
3 votes
2 answers
3k views

How to find out the maximum used stack space?

I am creating an Arduino sketch which involves quite some classes, and I want to check if it will run on an Arduino Uno or Mega (2 KB vs 8 KB SRAM). So far my global variables take up around 1,200 ...
Michel Keijzers's user avatar
3 votes
1 answer
2k views

How do string pointers work in Arduino?

To the best of my understanding, when I declare String s = "This is a string."; what happens is that space is allocated on the stack for a pointer which points to some String object which internally ...
Samuel S's user avatar
3 votes
2 answers
2k views

AVR & PIC 8-bit Microcontrollers - Can you add: external flash memory, external RAM, video & audio output, more address busses?

so I was planning on creating a mini PC out of basic ICs and 8-bit microcontrollers such as ATTinys and/or PICs and I have several questions regarding those: Can you add external RAM, say with SRAM, ...
Shimon Pokrivka's user avatar
3 votes
2 answers
708 views

Understanding memory fragmentation due to char arrays in functions

This is similar to: Is this function subject to memory fragmentation? I am trying to get my head around Memory fragmentation in Arduino's and embedded systems in general. Currently I have a ...
NMech's user avatar
  • 143
3 votes
3 answers
3k views

How to remove SD card safely

I’m constructing an arduino based sytem that uses a SD card and I’m looking for a way to safely remove the card from the system during operation. One way would probably be to turn of the arduino ...
NoobPointerException'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
3 votes
2 answers
150 views

How to leak function addresses?

I'm doing some security research on FreeRTOS embedded systems and I don't have much information about Arduino. Is there any way to leak function or variable addresses on serial console? I can use avr-...
user avatar
3 votes
1 answer
12k views

Using pointers with Arduino

I am learning about pointers. I was wondering how the memory address is defined in programming. I get different outputs depending on the format I choose for memory address. So I was wondering if it ...
Jack's user avatar
  • 143
3 votes
1 answer
114 views

Best way of storing extra data for Arduino project

I am an arduino beginner and I am trying to make a speed camera alert system, it would start beeping if I am above the speed limit and getting close to the speed camera. There is this website where I ...
Phamaral's user avatar
2 votes
3 answers
4k views

Simple memory chip for Arduino?

My basic question is: What is a good alternative to EEPROM chips for external memory on the Arduino Unor R3? I know that there are EEPROM chips when one would like an external memory chip. It, in ...
John Doe's user avatar
  • 131
2 votes
1 answer
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. ...
sgmm's user avatar
  • 175
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
2 votes
1 answer
3k views

Does the StringObject.reserve() function prevent memory fragmentation/leaks?

I'm currently writing and testing a professional Arduino application, I'm aware of the dangers of using the String class, so I began to implement C-style strings in some places, but it's just way ...
Jorge Gonçalves's user avatar
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
2 votes
3 answers
1k views

Using malloc() and free() for a stack/linkedlist [closed]

I know this question has been asked before, however it was asked two years ago and I have some other constraints to add. (Previous question here) : Is using malloc() and free() a really bad idea on ...
Brydon Gibson's user avatar
2 votes
1 answer
2k views

Can stack size be determined by free heap?

i have NodeMCU with es8266 onboard on it. I read heap and stack memory are facing each other and if heap or stack gets full and reachs another strange things happen. So i am wondering if can we use ...
alphaceph's user avatar
2 votes
2 answers
2k views

Using SD shield for extra external memory?

I am an Arduino beginner and I am planning to make a musical instrument with it. I want to add record and playback functionalities into the instrument. I figure I will have to store lots of data to ...
David Liao's user avatar
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
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
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
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
2 votes
1 answer
71 views

is PIN To PIN matching mcu against Atmega328P-AU available? [closed]

I want to upgrade my product which is based on Atmega328p-AU, having the problem of programming memory. I don't want to change the PCB of the product. Is PIN To PIN matching MCU against Atmega328P-AU ...
shadab's user avatar
  • 579
2 votes
1 answer
103 views

Which platform is better to debug Arduino memory problems? Linux or Windows?

I am developing a product. I developed every module in the firmware individually. Now I am integrating them but getting memory issues. I am not able to see how the memory is allocated inside the MCU ...
bandejiya's user avatar
  • 307
2 votes
2 answers
4k views

Update variable using buttons

I made a part of code to change the temperature limit for alarm system. On warm days user have to change the temperature limit with buttons and OLED display. The question is: How can the variable ...
Jim's user avatar
  • 151
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
2 votes
3 answers
722 views

How do I create global pointers with low memory overhead?

Problem I have a few large objects in my code that need global visibility, but creating them seems to eat up memory significantly faster than simple math would dictate, and furthermore, using them ...
sgbrown's user avatar
  • 123
2 votes
1 answer
2k 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 ...
Yevgenii Shashkov's user avatar
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
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
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
2 votes
0 answers
483 views

why is memcpy of unsigned long killing my sampling speed?

I'm using a Mega 2560 to communicate with a mixture of analog (i.e. measured via analogRead()) and I2C based sensors. Sampled data is placed in a 16 byte array, then written to an SD card once a 512 ...
Blake Hewgill's user avatar
2 votes
0 answers
902 views

Cant get rid of Soft WDT reset using ESP8266

Im using ESP12E DevKit v2 (esp8266 wifi module) board for controlling relays and displaying DHT22 temp,humidity on web server. It runs smoothly but after while i always get a watchdog timer reset. (If ...
Dan's user avatar
  • 41
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
1 vote
2 answers
3k 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 ...
Dat Ha's user avatar
  • 2,913
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