Teensy 4 dynamic memory space

Status
Not open for further replies.

stivo

Member
Hi,

I have a project for my Teensy 4 that I initially wrote using Arduino 1.8.10 and Teensyduino 1.48. When I compile it I still have plenty of dynamic memory available:

Code:
Sketch uses 125744 bytes (6%) of program storage space. Maximum is 2031616 bytes.
Global variables use 497200 bytes (47%) of dynamic memory, leaving 551376 bytes for local variables. Maximum is 1048576 bytes.

I just upgraded to Teensyduino 1.52 and the results are much different. It seems half the dynamic memory is missing:

Code:
Sketch uses 127024 bytes (6%) of program storage space. Maximum is 2031616 bytes.
Global variables use 529076 bytes (100%) of dynamic memory, leaving -4788 bytes for local variables. Maximum is 524288 bytes.
data section exceeds available space in board

As you can see the memory usage and availability is much different. I'm using the same libraries and same code. Why has the maximum available memory been cut in half between these versions? What did I miss?

Thanks for your time.
 
Last edited:
In version 1.48 dynamic memory consisted of both RAM1 and RAM2 combined, if RAM2 was never used then any program that was compiled showing over 50% of dynamic memory usage would cause an error. This obviously caused confusion for those who weren’t aware of RAM2 and that it is not automatically used so in 1.52 it only shows RAM1 to avoid confusion. Since you are using so much memory you should consider placing large uninitialized arrays in RAM2 so you can make use of the other half of available memory.
 
In version 1.48 dynamic memory consisted of both RAM1 and RAM2 combined, if RAM2 was never used then any program that was compiled showing over 50% of dynamic memory usage would cause an error. This obviously caused confusion for those who weren’t aware of RAM2 and that it is not automatically used so in 1.52 it only shows RAM1 to avoid confusion. Since you are using so much memory you should consider placing large uninitialized arrays in RAM2 so you can make use of the other half of available memory.

Searching for RAM2 I found another thread where you mentioned "Any calls to malloc or new will go to RAM2...". I initialized some of my large arrays using new and I now have large amounts of dynamic memory available.

Thanks so much for your help and quick answer. Cheers!
 
Status
Not open for further replies.
Back
Top