6 years, 8 months ago.

When the RTC hits 10000 seconds elapsed the RAM usage increases by ~32 bytes.

As per the title, I've noticed by monitoring the amount of unallocated RAM on my STM32F429ZI running mbed.h, that the memory increases by 64 bytes at somehwere seemingly randomly between 35 and 200 seconds duration on the RTC and at 10000 seconds 100% of the time it increases again by 32 bytes.

I'm assuming this is allocating memory regarding the storage of the number of seconds in some fashion. Just to confirm, I'm not doing the mallocing here.

I just wanted to know where exactly this occurs and what the reason was (which I could determine knowing where)


Can you comment a bit more on what program you are running? Your target uses a single 32-bit timer for the normal timekeeping purposes, so no need to allocate anything there. So what program do you run, and do you run regular mbed library, or mbed-os?

posted by Erik - 26 Jun 2017

I am running the mbed library, not the OS. All my malloc'ing has a debug mode flagged which makes it dump what it's doing to serial and it's not coming up (as I've disabled the allocating parts to see what this part was doing). It constantly dumps a carrirage returned string as "[%9.4f]", getTime() which is just a seconds reset t.read() + RTC floating point return. I'm thinking the way it optimised was such that when the serially printed string (pc.printf("[%9.4f] \r", getTime()) needs a new placeholder for the extra character, it allocates in order to achieve that.

posted by Matt P 27 Jun 2017
Be the first to answer this question.