Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: How to read memory usage compile data

  1. #1

    How to read memory usage compile data

    How exactly does one read the memory usuage compile data for Teensy?

    Code:
    Memory Usage on Teensy MicroMod:
      FLASH: code:164080, data:33808, headers:8956   free for files:16308228
       RAM1: variables:47424, code:161560, padding:2280   free for local variables:313024
       RAM2: variables:18112  free for malloc/new:506176
    I'm specifically trying to figure out how much RAM I have available. Is that displayed in this information?

    Are the numbers displayed in bits or bytes?

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    17,106
    Yes, the line: RAM1: variables:47424, code:161560, padding:2280 free for local variables:313024

    Shows the static allocations for the resultant binary.

    More info on T_4.x memory is at: pjrc.com/store/teensy41.html#memory

    RAM1 holds all 'code:164080' not kept/executed in FLASH in 32KB blocks of ITCM portion of the RAM1's 512KB - where 'padding:2280' is the remainder of a 32KB block not holding actual code. The remainder of RAM1 is DTCM for 'variables:47424' initialized or other 'reserved' memory (not run time allocated) in this case leaving 'free for local variables:313024'

    RAM1 runs at full processor speed.

  3. #3
    Thanks, that helps a ton!

    The one thing I haven't been able to find out: is "313024" is bytes or bits? Aka – how many KB is 313024?

  4. #4
    Senior Member BriComp's Avatar
    Join Date
    Apr 2014
    Location
    Cheltenham, UK
    Posts
    1,233
    What is the size of RAM1 before any compilation.
    I think that if you add all the memory usage together you will find that it's obviously bytes.

  5. #5
    Quote Originally Posted by BriComp View Post
    I think that if you add all the memory usage together you will find that it's obviously bytes.
    Yeah, you'r right – I just needed someone smarter than me to confirm. Following the link, RAM1 was labeled 512K (not b or B), so the extra confirmation was helpful. Knowing more about all the conversions would have helped me figure it out myself, but I just didn't know for 100% after my reading and research.

    Thanks!

  6. #6
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    17,106
    Indeed, the build output doesn't indicate Bytes - though that is the implied typical measure. And the linked page is sparse with the word BYTE as well and shows 'K' without a 'B' indicator.

  7. #7
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,943
    Yeah, it's bytes.

    Quote Originally Posted by isaacjacobson View Post
    Aka – how many KB is 313024?
    Where KB is understood to mean 1024 bytes, and typically you would round down to avoid any risk of overstating the amount of available memory, the answer would be 305KB.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •