RunningAverage icon indicating copy to clipboard operation
RunningAverage copied to clipboard

Memory Usage

Open JCW-74 opened this issue 1 year ago • 7 comments

Hi Rob,

It is unclear how big the arrays can be. I experienced bizarre sketch behaviour when I made them apparently too large (300), obviously overwriting something important. Can you show the limitations?

JCW-74 avatar Aug 03 '24 04:08 JCW-74

Thanks for your question. In theory the size is 16 bit so max around 65000. The internal variables like size and count are 16 bit.

In practice it depends on the board you use and possibly the compiler flags.

From my head, the library need to store a float array of N elements and this takes 4N bytes. Furthermore some administrative bytes. 300 elements need therefor at least 1200 bytes which is a lot for an UNO and not so much for an ESP32.

RobTillaart avatar Aug 03 '24 05:08 RobTillaart

What board do you use?

RobTillaart avatar Aug 03 '24 05:08 RobTillaart

Hi Rob,Greetings from Australia.That was quick!  Thanks. I am displaying physiological pressures on a UNO.  250 or so is fine for this.  Sent from my iPhoneOn 3 Aug 2024, at 15:01, Rob Tillaart @.***> wrote: What board do you use?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

JCW-74 avatar Aug 03 '24 06:08 JCW-74

Meant to say “bog-standard UNO”.  ESP32 looks good for next project.Sent from my iPhoneOn 3 Aug 2024, at 15:01, Rob Tillaart @.***> wrote: What board do you use?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

JCW-74 avatar Aug 03 '24 06:08 JCW-74

Greetings from Australia. That was quick!

You're welcome,

Can you do a test run and sent the number on 257. If you get strange results there might be an 8 bit overflow somewhere in the code.

RobTillaart avatar Aug 03 '24 07:08 RobTillaart

Will do, Rob.  Out tonight, on the town. I’ll get back to you tomorrow.Sent from my iPhoneOn 3 Aug 2024, at 17:36, Rob Tillaart @.***> wrote:

Greetings from Australia. That was quick!

You're welcome, Can you do a test run and sent the number on 257. If you get strange results there might be an 8 bit overflow somewhere in the code.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

JCW-74 avatar Aug 03 '24 09:08 JCW-74

@JCW-74 Did you find time to do the test with size 257?

RobTillaart avatar Aug 12 '24 15:08 RobTillaart

@JCW-74 Did you find time to do the test with size 257? (otherwise I close this issue)

RobTillaart avatar Aug 27 '24 16:08 RobTillaart

Hi Rob. Being new to this I actually responded by email on the same day and not here on GitHub. Using 257 made no difference and so I think it is just a memory overflow issue. I reduced the number of points and it worked fine. Thanks again.

JCW-74 avatar Aug 27 '24 22:08 JCW-74

Ok, thanks for the update

RobTillaart avatar Aug 28 '24 06:08 RobTillaart

As the problem seems solved, I close the issue.

RobTillaart avatar Aug 28 '24 07:08 RobTillaart