Open DrZlo13 opened 1 month ago
Compiled f7 firmware for commit d4b70a6a
:
Regarding the 8-byte alignment, GCC indeed appears to make that assumption, with or without -Os
.
This code:
int32_t align_test_app(void* p) {
UNUSED(p);
FURI_LOG_I("TEST", "Hello world");
FURI_LOG_I("TEST", "I'm align_test!");
void* b = malloc(4);
uintptr_t valB = (uintptr_t)b;
return (valB & 7) == 0;
}
compiled into:
So it's a very good idea to guarantee proper alignment, at least for malloc
and realloc
.
PVS-Studio report for commit 7d50f4b5
:
I disabled all dolphin animations and ran some tests:
: free Free heap size: 141416 Total heap size: 185560 Minimum heap size: 137696 Maximum heap block: 140328 Aux pool total free: 2752 Aux pool max free block: 2644
: free Free heap size: 141304 Total heap size: 185560 Minimum heap size: 125768 Maximum heap block: 132512 Aux pool total free: 2752 Aux pool max free block: 2644
: free Free heap size: 146200 Total heap size: 185544 Minimum heap size: 142512 Maximum heap block: 145136 Pool free: 1464 Maximum pool block: 1348
: free Free heap size: 146136 Total heap size: 185544 Minimum heap size: 142440 Maximum heap block: 145296 Pool free: 1464 Maximum pool block: 1348
It looks like in the current version tlsf has no meaning except for the correct implementation of realloc.
What's new
Verification
Checklist (For Reviewer)