Commit Graph

27 Commits

Author SHA1 Message Date
Guillaume Souchere 0fcb10c71a Remove the call to tlsf_assert in the tlsf_insist maccro
In this commit:
The call to tlsf_asssert is removed from tlsf_insist to allow the tlsf_check()
function to return when one or more of the tlsf_insist() calls fails. In the previous
implementation any failing tlsf_assist() was causing the tlsf_assert to terminate the
execution of the application which doesn't allow the user to handle failures in tlsf_check()
eventhough tlsf_check() returns a value.
2022-08-10 08:26:12 +02:00
Guillaume Souchere 9393b12cac Add a function hook called in tlsf_check() on every free block of memory
In this commit:
- We add a weak delcaration of tlsf_check_hook() in tlsf.h.
- We call tlsf_check_hook() in tlsf_check() if the function has a defintion

This hook function allows the user to implement application specific checks on
the memory of every free blocks (e.g. check for memory corruption).
2022-08-10 08:26:10 +02:00
Guillaume Souchere ff11688f24 Incorporate wrong chunk size bugfix
See https://github.com/espressif/esp-idf/commit/9516fd09c2ed6b3726ebdad99406d940d955a08e
for more details.
2022-07-29 09:39:58 +02:00
Ivan Grokhotkov 1968e04261 introduce tlsf_memalign_offs
Initial commit: https://github.com/espressif/esp-idf/commit/d902b4e7db2b5b6d3f6f9752691ddb9fb4366594
2022-07-29 09:39:32 +02:00
Ivan Grokhotkov b76f0fefd1 Add heap poisoning mechanism to fill absorbed block header with the right pattern.
Note: block_absorb() is called in tlsf_free(), which is eventually called in multi_heap_free()
after the memory fill is done. As the block_absorb merges 2 blocks together, the previous block
header of the merged block is now in the middle of the memory block but not filled with 0xfe.

- Remove dependencies with the heap component of the IDF.
- The tlsf_poison_fill_region_hook() function is defined as weak in IDF and checked for NULL
in block_absorb() function in order to minimize the dependencies between IDF and the TLSF.
- The the implementation of tlsf_poison_fill_region_hook() must be provided at the discretion
of the user.
2022-07-26 14:40:25 +02:00
Ivan Grokhotkov 1322e839d2 add some comments to block_split and block_trim_free_leading 2022-07-26 14:40:25 +02:00
Guillaume Souchere 7d2c0f2264 Inline functions in tlsf.c and tlsf_block_functions.h
Use the attribute __attribute__((always_inline)).
2022-07-26 14:40:23 +02:00
Guillaume Souchere 81cecf2e0d move block_header_t, control_t, tlsfptr_t to tlsf_common.h and block function to tlsf_block_functions.h 2022-07-26 14:39:07 +02:00
Ivan Grokhotkov bfd855894d move tlsf_min, tlsf_max, tlsf_cast to the tlsf_common.h header file 2022-07-26 14:38:30 +02:00
Ivan Grokhotkov 6723d4fc98 tlsf_public and tlsf_private moved to tlsf_config enum in tlsf_common.h header 2022-07-26 14:38:30 +02:00
Ivan Grokhotkov 1f77a1d2a1 add tlsf_block_functions.h and tlsf_common.h files 2022-07-26 14:38:30 +02:00
Ivan Grokhotkov 61bbda7f4a move includes to tlsf.c, add license 2022-07-25 12:45:58 +02:00
Matt Conte deff9ab509 Update tlsf.c
Unsigned fix from Chris McEvoy @ Velan Studios.
2020-03-29 09:55:11 -07:00
matt conte a1f743ffac Merge pull request #3 from velvitonator/large-alloc-corruption
Protect against large sizes resulting in off-the-end free blocks
2018-02-21 22:07:31 -08:00
matt conte 16b6a9657d Merge pull request #2 from ralphyon/master
Fix block_size_max handling in adjust_request_size
2018-02-21 22:06:57 -08:00
Vitor Menezes 72601dd683 Protect against large sizes resulting in off-the-end free blocks 2017-05-11 00:04:48 -07:00
Martin Dufour 2b73b8a482 Fix block_size_max handling in adjust_request_size
In the 64-bit build, an allocation of request in the range
]block_size_max-ALIGN_SIZE,block_size_max[ could cause an out-of-bounds
access to sl_bitmap.
2016-08-01 07:51:11 -04:00
matthew conte 7d6c9a78da Fix broken link, placeholder text in copyright. 2016-04-11 17:08:29 -07:00
matthew conte bd50675b3c Fix it so it really compiles this time. 2016-04-11 16:59:11 -07:00
matthew conte 9620facc84 Fix tlsf.c so it compiles. 2016-04-11 16:57:49 -07:00
matthew conte a7e1d103d1 Fix broken link. 2016-04-11 16:54:46 -07:00
matthew conte a9c9020812 Merge pull request #1 from salkinium/master
Fix [-Wstrict-prototypes] warnings.
2016-04-11 15:07:47 -07:00
Niklas Hauser 757298305a Fix [-Wstrict-prototypes] warnings. 2016-04-11 21:13:44 +01:00
matthew conte 8b7c441ecf Added files via upload
Add tlsf.h, tlsf.c, version 3.1.
2016-04-10 15:02:17 -07:00
matthew conte 265a6c3798 Update README.md 2016-04-10 15:01:34 -07:00
matthew conte 150d9f97aa Update README.md 2016-04-10 15:01:07 -07:00
mattconte cee96d6b9c Initial commit 2015-05-26 11:31:33 -07:00