Questions tagged [memory-usage]

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

Filter by
Sorted by
Tagged with
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
325 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
230 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
327 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
86 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
89 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
5k 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(); ...
3
votes
1answer
310 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
3k 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 ...
2
votes
1answer
927 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
236 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 ...
2
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. ...
5
votes
3answers
14k 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
85 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 ...
1
vote
1answer
554 views

EEPROM - Storing Static Data

I'm trying to store four items to EEPROM. I can do one item no problem, I just don't know how to make the jump to multiple items. My code: #include <EEPROM.h> char sgrpID[31] = "acpilot's ...
0
votes
1answer
141 views

send serial monitor to server and save data in hdd [closed]

I'd like stream data to my disk via serial and then send it to a central server. e.g. log an event. i wouldn't use any separate modules. Any helps appreciated.
3
votes
2answers
4k views

What is the best way to get more RAM for a sound buffer?

The problem: How to extend the memory for a sound buffer (intensively used) if: SD card library supports only one file open at a time (and I have one open already) EEPROM chips are able to stand ...
1
vote
1answer
81 views

'Non-Deterministic' memory usage on Arduino

I had a problem with a memory leak in my sketch and cornered it with MemoryFree.h. This works great and I was able to fix my leak. My sketch is not really static, but My var sizes are. I observed, ...
1
vote
2answers
621 views

Forensic security of Arduino (SRAM)

Pardon the double post, but I'm not getting much traction with this question over at arduino.cc so I'm looking for answers here now. Original post: http://forum.arduino.cc/index.php?topic=391698.0 ...
3
votes
3answers
817 views

Is this function subject to memory fragmentation?

I'm trying to understand if the following bit of code is subject to memory fragmentation. Let's say I incrementally build a string within a function and I don't know how large the string should be. ...
0
votes
1answer
468 views

Shared Memory using SHM Library

I am trying to read sensor data from a FIFO buffer embedded in the sensor (LSM9DS1), and store that data on a Teensy 3.2 board to later be put in a file. I can only read 6 bytes at a time from the ...
1
vote
1answer
386 views

Connecting Winbond W49F002U-12B to Arduino Mega

I am trying to connect a CMOS flash memory Winbond W49F002U-12B to an Arduino Mega, but failing. What I did: Read the Winbond W49F002U-12B datasheet. The key points are: CE - chip enabled; OE - ...
3
votes
2answers
2k views

At what level does low dynamic memory effect performance?

I have a few Arduino sketches that take 70-90% of dynamic memory. It seems that over 70%, the compiler gives the warning: Low memory available, stability problems may occur. but otherwise I wasn't ...
6
votes
1answer
507 views

Understanding global variables on Arduino

I am rewriting a set of LED manipulation functions to be more object oriented, and I have found that, mysteriously, my global variable memory space has been over consumed, despite a reduction of the ...
4
votes
2answers
74 views

Use large variables without using much memory

I've wired up a dot matrix, and I display characters on the screen by using something like the example code below. The Char_B variable is a global variable in a library used by the Arduino, and ...
0
votes
0answers
108 views

Is there a lean or modular SD library?

I'm using the SD library to perform two simple tasks. reading a configuration file writing a logfile I don't want to use subdirectories and can live with only two filenames. However, after linking ...
2
votes
1answer
7k views

Store String using F() Macro

I'm new to the Arduino and do not quite understand the F() macro yet. In my code, I have a String, and as I want to transfer it via WebServer, I need to write it to the answer. Somehow I need to ...
3
votes
2answers
1k views

What is the memory expense of creating a String from a char array?

I'm writing a little API for processing email messages in Arduinos. Obviously, I need to keep memory use down, but I also want to allow the end user to use the String functions (like indexOf) to ...
2
votes
2answers
392 views

Arduino Uno - why doesn't memory leak crash the program?

I wrote this test program: void loop() { digitalWrite(13,1); delay(300); digitalWrite(13,0); delay(300); void *a = malloc(10000000000000000000000000000000000000000); } Curiously, ...
0
votes
2answers
4k views

Clearing SRAM in loop()

Very broad question here. I don't know exactly what the problem is but I'll edit this post as we narrow down the possibilities. I think I'm running into memory constraints. I'm running a sketch ...
0
votes
2answers
353 views

How to prevent inclusion of unnecessary libraries?

How do you save space by preventing the inclusion of unnecessary binaries? When I compiled the ROS Blink example, I received the warning: Global variables use 1,951 bytes (76%) of dynamic memory, ...
3
votes
2answers
541 views

How to correctly pack an unsigned long from 3 unsigned chars?

I would like to use 652 unsigned long values on an Arduino Uno, but it doesn't look like there's enough memory. I thought about the splitting unsigned long values to 3 unsigned chars to store in ...
8
votes
2answers
4k views

OOP vs Inline with Arduino

I have been programming for quite a while now but I am new to Arduino and AVR Programming. The main question I have about programming these Micro-controllers is are there major differences in ...
0
votes
1answer
64 views

Serial problem after implementing data structures

Context I first ran a sketch (on Arduino Uno) without any custom data structure and list, so I was using a bunch of arrays, methods and other primitive variables. And it worked perfectly. My program ...
2
votes
1answer
381 views

What will use less memory, an array or if … else?

I'm trying to make my sketch smaller. Right now I use an array for the AM/PM part of my time display. My thinking is this makes it easy to change the formatting: char* ampms[]= {"am", "pm"}; void ...
4
votes
1answer
392 views

Why does this code execute?

After experiencing failures of my Arduino projects due to low memory, I decided to do some research into it so I could understand better where the problems were. I eventually came to this code: void ...
8
votes
1answer
1k views

Is there any way to run binary code from RAM?

I am looking for an inexpensive single board computer that I could program in assembly language, using limited facilities to load the object code from a PC and simple I/O peripherals. Ideally I would ...
0
votes
1answer
574 views

Serial3.available loop issue

I am trying to read information coming from an Atlas Scientific FLO30 chip. The following code works fine in an individual sketch: String inputstring = ""; ...
2
votes
3answers
4k views

How to write data in RAM memory using Arduino Uno or Arduino Due?

I know that it is possible to write data in ROM(Read Only Memory). But what about if I want to write data in RAM(Random Access Memory)? Can I do it using "Arduino Uno R3"? RAM is normally associated ...
1
vote
1answer
108 views

How do I know how many memory that Arduino is use after my code is running for a few time [duplicate]

When I upload my program to Arduino it says the memory that the program is used. But what if I use a bad management of dynamic memory, or any object is created several times in use a lot of memory and ...
2
votes
1answer
841 views

Measure SRAM usage

I am using an Arduino with 2048 bytes of SRAM. I have a complex project so that it is no longer obvious how much SRAM it would use in total (there is not one large dominant object but many different ...
9
votes
1answer
709 views

Overview of compiled code size

When I compile my code, the Arduino IDE returns the binary sketch size in byte. Is there a good way to find out (approximately) what function or what part of my code takes up how much memory in ...
0
votes
2answers
274 views

How to increase Arduino's memory to save Dot Matrix Library?

I need to display some dynamic Chinese characters to 12864 using Arduino. What to show is transported from my web server. The character is stored as a 16x16 dot matrix, needing 16*16/8=32 byte. And I ...
0
votes
1answer
555 views

Memory Problems on Arduino Uno

I am doing a project using Arduino UNO, cc3000 WIFI chip, micro SD card shield, and a TTL serial camera in order to make a security system that will post a picture online (not enough processing power ...
2
votes
1answer
846 views

Am I Running Out of RAM Or Not?

I'm attempting to drive 300 TM1803 RGB LEDs from an Arduino Uno using the FastLED library. My code works fine for 100 LEDs, but when I go to 150, the arrays that store LED values and my sensor data ...
0
votes
1answer
559 views

How can I analyse large packets on an Arduino?

I'm trying to send a large packet to an Arduino with an ethernet shield on it. I'm using the built-in RX buffer of the W5100 controller to store the data, but I need more memory (at least 16K of ...
2
votes
2answers
247 views

Is there any way that the values here be converted to another variable and not string?

int val1 =(mfrc522.uid.uidByte[0]); int val2 =(mfrc522.uid.uidByte[1]); int val3 =(mfrc522.uid.uidByte[2]); int val4 =(mfrc522.uid.uidByte[3]); String valA=String(val1); String valB=String(val2); ...
2
votes
1answer
503 views

Are my arrays stored in sram or in Flash?

I have the following memory allocation: unsigned char g1[]={ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ....0x00 ,0x00 ,0x00 ,0x00 ,0x00 }; g2[]={ 0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 .......
0
votes
2answers
391 views

releasing memory in sub-function

I'm doing a program who get a line from the SD and shows it, this function is called getData() FULL CODE: #include <SD.h> #include <MemoryFree.h> File myFile; int stringIndex = 0; int ...
0
votes
1answer
2k views

Can arduino create a file in its memory?

I am an arduino enthusiast and i am new to it.just wanted to know weather the micro processor itself could create a file in its memory while its is running. I know that it is possible to read a write ...