# System Memory C++ usage

**URL:** <https://community.particle.io/t/system-memory-c-usage/21377>\
**Category:** Firmware\
**Created:** [March 23, 2016, 2:10pm UTC](https://community.particle.io/t/system-memory-c-usage/21377 "2016-03-23T14:10:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![wesner0019](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@wesner0019](https://community.particle.io/u/wesner0019)\
**Post date:** [March 23, 2016, 2:10pm UTC](https://community.particle.io/t/system-memory-c-usage/21377/1 "2016-03-23T14:10:53Z")

</div>

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.

Thanks,

---

<div class="post-metadata">

**Author:** ![BulldogLowell](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/bulldoglowell/32/4305_2.png) [@BulldogLowell](https://community.particle.io/u/BulldogLowell)\
**Post date:** [March 23, 2016, 2:22pm UTC](https://community.particle.io/t/system-memory-c-usage/21377/2 "2016-03-23T14:22:32Z")

</div>

The compiler optimizes that for you, so likely no.

---

<div class="post-metadata">

**Author:** ![AndyW](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyw/32/686_2.png) [@AndyW](https://community.particle.io/u/AndyW)\
**Post date:** [March 23, 2016, 3:37pm UTC](https://community.particle.io/t/system-memory-c-usage/21377/3 "2016-03-23T15:37:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![wesner0019](https://avatars.discourse-cdn.com/v4/letter/w/0ea827/32.png) [@wesner0019](https://community.particle.io/u/wesner0019)\
**Post date:** [March 25, 2016, 3:53am UTC](https://community.particle.io/t/system-memory-c-usage/21377/4 "2016-03-25T03:53:48Z")

</div>

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?  
[https://pixhawk.org/dev/runtime\_and\_ram\_optimization](https://pixhawk.org/dev/runtime_and_ram_optimization)

---

<div class="post-metadata">

**Author:** ![AndyW](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/andyw/32/686_2.png) [@AndyW](https://community.particle.io/u/AndyW)\
**Post date:** [March 25, 2016, 1:18pm UTC](https://community.particle.io/t/system-memory-c-usage/21377/5 "2016-03-25T13:18:48Z")

</div>

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.
