Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4060

SDK • Re: Proper way to get Heap size

$
0
0
A little more clean up and some checks added and I think it's working correctly

Code:

ReadySTACK_EXTEND        : 14 k__HEAP_UPPER        : 0x2003C800HEAP_ADDRESS        : 0x20001D80HEAP_SIZE           : 240256 bytesDEBUG: init_memory 0x20001D80  with 240256 bytes  0x2003C800Total Entries     1    Used Entries     0    Free Entries     1Total Blocks  30030    Used Blocks      0    Free Blocks  30030Usage Metric:                   0Fragmentation Metric:           0Free heap :                 240240 bytesLargest free space :        240240 bytes>> MAIN LOOP HAS ENDED PLEASE RESET! <<
Same test RP2350

Code:

ReadySTACK_EXTEND        : 14 k__HEAP_UPPER        : 0x2007C800HEAP_ADDRESS        : 0x200024D0HEAP_SIZE           : 500528 bytesDEBUG: init_memory 0x200024D0  with 500528 bytes  0x2007C800Total Entries     1    Used Entries     0    Free Entries     1Total Blocks  29796    Used Blocks      0    Free Blocks  29796Usage Metric:                   0Fragmentation Metric:           0Free heap :                 238368 bytesLargest free space :        238368 bytes>> MAIN LOOP HAS ENDED PLEASE RESET! <<
Same test RP2350 with 16 byte blocks rather than 8 byte blocks

Code:

ReadySTACK_EXTEND        : 14 k__HEAP_UPPER        : 0x2007C800HEAP_ADDRESS        : 0x200024D0HEAP_SIZE           : 500528 bytesinit_memory 0x200024D0  with 500528 bytes  0x2007C800Total Entries     1    Used Entries     0    Free Entries     1Total Blocks  31281    Used Blocks      0    Free Blocks  31281Usage Metric:                   0Fragmentation Metric:           0Free heap :                 500496 bytesLargest free space :        500496 bytes>> MAIN LOOP HAS ENDED PLEASE RESET! <<
I'll need to make some modifications to my library to allow for block resizing since the RP2350 has so much more memory and umm_malloc states
Each memory block holds 8 bytes, and there are up to 32767 blocks available, for about 256K of heap space. If that's not enough, you can always add more data bytes to the body of the memory block at the expense of free block size overhead.

Statistics: Posted by DarkElvenAngel — Sat Dec 21, 2024 6:36 pm



Viewing all articles
Browse latest Browse all 4060

Trending Articles