summaryrefslogtreecommitdiffstats
path: root/common/dummy_malloc.c
Commit message (Collapse)AuthorAgeFilesLines
* common: malloc: ensure alignment is always at least 8 byteAhmad Fatoum2023-09-261-1/+1
| | | | | | | | | | | | | | | | | We used to have following alignments: 32-bit CPU 64-bit CPU dummy 8 bytes 8 bytes dlmalloc 8 bytes 16 bytes tlsf 4 bytes 8 bytes With recent change to TLSF, we now always have at least 8 bytes as alignment. To make this clearer, define a new CONFIG_MALLOC_ALIGNMENT and either use it as the alignment (as done for dummy) or add static asserts to ensure we have at least this alignment. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230911152433.3640781-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* common: dummy_malloc: remove unintended GPL2 eCos-exception-2.0Ahmad Fatoum2020-11-271-20/+1
| | | | | | | | | | | | | | | | | | | Apparently, the file should be GPL-2.0-only without exceptions: On 24.11.20 09:44, Sascha Hauer wrote[1]: > This looks like I accidently copied the wrong header. I don't think I > did this on purpose. It doesn't make much sense to me when compiling > against dummy malloc is different than compiling against tlsf malloc > or dlmalloc. As dropping exceptions is no relicense, it's ok to do here without acknowledgement from all authors. Do so. [1]: <20201124084434.GC14718@pengutronix.de> Suggested-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dummy_malloc: Check if sbrk() failsAndrey Smirnov2018-10-161-0/+5
| | | | | | | | Add code to check if sbrk() fails as well as setting appropriate 'errno' for users that may rely on it for error reporting. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dummy_malloc: Make use of PTR_ALIGNAndrey Smirnov2018-10-161-4/+2
| | | | | | | Drop explicit type cast and alignement code in favor of PTR_ALIGN Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* tlsf_malloc: dummy_malloc: Share code for calloc()Andrey Smirnov2018-10-161-13/+0
| | | | | | | | | | | | | Calloc() implementation for TLSF does not correctly check for malloc() failure which can result in a NULL pointer exception when trying to calloc() extra large buffers. Since both TLSF and dummy malloc implementations of calloc() are exactly the same, pick implementation for the latter (which does aforementioned check) and share it between the two. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* xfuncs: Be more informative when out of memory panic occursSascha Hauer2017-04-281-0/+4
| | | | | | | | When one of the xfuncs panics we can be a bit more informative. We can at least print the amount of bytes we wanted to allocate and how much memory we have left. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dummy malloc: Add licence headerSascha Hauer2013-03-081-0/+23
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* dummy_malloc: add calloc supportJean-Christophe PLAGNIOL-VILLARD2012-01-111-0/+12
| | | | | | | needed to use menu framework Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* add dummy_malloc functionsSascha Hauer2011-04-111-0/+26
For some environments the dummy malloc functions offer a very small alternative implementation. malloc will get its memory from sbrk() and never frees memory again. This of course is not suitable for interactive environments and thus depends on CONFIG_SHELL_NONE Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>