tomstewart89 / BasicLinearAlgebra

A library for using matrices and linear algebra on Arduino
MIT License
187 stars 38 forks source link

Library using too much memory when used in classes? #30

Closed AdamMarciniak closed 3 years ago

AdamMarciniak commented 3 years ago

Is this library safe to use with many instances of a class? For example where I'd have each instance of a class have it's own matrices. I've heard this may blow up somehow?

thomascent commented 3 years ago

Hey @polishdude20, it's fine to use multiple instances of a BLA::Matrix in the same program so long as you don't exceed the amount of RAM available to your microcontroller.

For example, an Arduino uno has 2kB of RAM so you if you declare two float matrices each of size 10x10, that'll consume 2x10x10x4 = 800bytes and your program will run just fine. If you instead declare 10 of those matrices you'll need 4kB of RAM which you don't have and your program will crash.

Hope that helps clear things up!

AdamMarciniak commented 3 years ago

Awesome thanks !