Commit Graph

14 Commits

Author SHA1 Message Date
Guillaume Souchere
e282f0be5a Merge branch 'feat/add-return-value-to-walker' into 'idf'
change(tlsf): Add return value to tlsf_walker

See merge request espressif/tlsf!9
2024-03-19 15:35:55 +08:00
Guillaume Souchere
b2f44c4bf3 feat(tlsf): Add a function to malloc at a given address
The function will find a suitable free block that can contain
the malloc size at the given address in the memory pool, split
the free block to create the block that will contain the allocated
memory, update the status of the newly created blocks (free / used)
and return the pointer to the memory allocated at the given address.

If no block is found (the status of the heap doesn't allow for an
allocation at the given address) the function will return NULL.
2024-03-06 07:33:08 +01:00
Guillaume Souchere
84048e02ba change(tlsf): Add return value to tlsf_walker
This commit adds a return boolean value to the tlsf_walker
function allowing users to interrupt the traversal of the
pool when returning from any call to the tlsf_walker.
2024-02-27 12:27:38 +01:00
Guillaume Souchere
eaa11bbf5d tlsf: fix input validation of tlsf_t parameter and comment tlsf_fit_size() 2022-10-19 07:53:06 +02:00
X-Ryl669
4d43b0df1c Multiple heap TLSF 2022-09-20 10:22:27 +02:00
Guillaume Souchere
83dac36eda Add missing doxygen comments on the tlsf_check_hook() declaration 2022-08-25 11:57:43 +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
Ivan Grokhotkov
1968e04261 introduce tlsf_memalign_offs
Initial commit: d902b4e7db
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
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
matthew conte
7d6c9a78da Fix broken link, placeholder text in copyright. 2016-04-11 17:08:29 -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