System Memory C++ usage

I am wondering if the following statement: if(var == true) uses the same or more memory vs if(var) is used?

I am getting close to maxing out the 128K memory on the P1 and wondered if this could save some more space.


The compiler optimizes that for you, so likely no.

1 Like

Are you building locally ?

If so, arm-eabi-none-nm -n can be your friend by helping you identify the largest culprits and focusing your efforts there first, rather than playing guessing games.

There are plenty of other ways to skin this cat, that’s just a good starting point if you’re entering this territory.


I have not been building locally, mainly using the Dev platform. I’ll check out your suggestion though! I do have all the things need to build locally just havn’t had much time to dig in.

Found this link. So a procedure like this then?

Yes, that’s the idea.

The key is that you have hard data that you can use to target your efforts and measure your progress. That alone is worth the price of admission, IMHO.

1 Like