Skip to content

Commit 172895f

Browse files
committed
Improve allocation performance on STM32 platform
Make the local_heap_setup conditional unlikely to improve performance of memory allocation since this only is true only at the first memory allocation. Signed-off-by: Winford <winford@object.stream>
1 parent 641d610 commit 172895f

File tree

1 file changed

+1
-1
lines changed
  • src/platforms/stm32/src/lib

1 file changed

+1
-1
lines changed

src/platforms/stm32/src/lib/sys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void *_sbrk_r(struct _reent *reent, ptrdiff_t diff)
6969
{
7070
uint8_t *_old_brk;
7171

72-
if (_heap_end == NULL) {
72+
if (UNLIKELY(_heap_end == NULL)) {
7373
local_heap_setup(&_cur_brk, &_heap_end);
7474
}
7575

0 commit comments

Comments
 (0)