This website requires JavaScript.
Explore
Help
Sign In
RIOT-OS
/
RIOT
Watch
1
Star
0
Fork
0
You've already forked RIOT
mirror of
https://github.com/RIOT-OS/RIOT.git
synced
2024-12-29 04:50:03 +01:00
Code
Releases
Activity
f3e348dee0
RIOT
/
pkg
/
tlsf
/
contrib
/
Makefile
6 lines
91 B
Makefile
Raw
Normal View
History
Unescape
Escape
pkg/tlsf: Fix the way system functions are overriden. The correct way to overrride the malloc family of functions in newlib-nano is to provide the *_r (reentrant) variants. Newlib implements the "normal" functions on top of these (see the newlib source code). Also, internally it calls the *_r functions when allocating buffers. If only the "normal" non-reentrant functions are provided this will mean that some of the code will still use the vanilla newlib allocator. Furthermore, if one uses the whole heap as a pool for TLSF then the system may in the best case crash as there is no enough memory for its internall allocations or in the worst case function eratically (this depends on how the heap reserved, there is an upcomming series of commits in that direction). This commit splits the handling between newlib and native. It also prepares the ground for future work on the pool initialization. Right now I could only test this in ARM and native and I cannot ensure it will work on other platforms. Replacing the system's memory allocator is not something that can be taken lightly and will inevitably require diving into the depths of the libc. Therefore I would say that using TLSF as a system wide allocator is ATM supported officially only on those plaftorms. Testing: Aside from reading the newlib sources, you can see the issue in a live system using the debugger. Compile any example (with or without tlsf-malloc), grab a debugger and place a breakpoint in sbrk and _sbrk_r. Doing a backtrace will reveal it gets called by _malloc_r.
2019-08-19 16:31:06 +02:00
MODULE
=
tlsf-malloc
SUBMODULES
=
1
SRC
=
tlsf-malloc.c
pkg/tlsf: Refactor the TLSF package and bring back original TLSF api. - Cleanup package makefile. - Download directly from git. - Remove giant patch. - Implement malloc function as a contrib package. - Update ccn example. - Update ps command.
2018-04-20 11:12:33 +02:00
i
n
c
l
u
d
e
$(
RIOTBASE
)
/
M
a
k
e
f
i
l
e
.
b
a
s
e
Copy Permalink