You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The memory address allocated by the malloc function must be aligned twice void *, which means that for 64-bit system, 16-byte alignment is required, and for 32-bit system requires 8-byte alignment.
If you simply modify the macro definition, TLSF will crash directly. How to do this modification?
diff --git a/tlsf.c b/tlsf.c
index af57573..6e87539 100644
--- a/tlsf.c
+++ b/tlsf.c
@@ -211,15 +211,15 @@ enum tlsf_public
SL_INDEX_COUNT_LOG2 = 5,
};
-/* Private constants: do not modify. */
+/* Private constants: do not modify. why ??? */
enum tlsf_private
{
#if defined (TLSF_64BIT)
- /* All allocation sizes and addresses are aligned to 8 bytes. */
- ALIGN_SIZE_LOG2 = 3,
+ /* All allocation sizes and addresses are aligned to 8(->16) bytes. */
+ ALIGN_SIZE_LOG2 = 4,
#else
- /* All allocation sizes and addresses are aligned to 4 bytes. */
- ALIGN_SIZE_LOG2 = 2,
+ /* All allocation sizes and addresses are aligned to 4(->8) bytes. */
+ ALIGN_SIZE_LOG2 = 3,
#endif
ALIGN_SIZE = (1 << ALIGN_SIZE_LOG2),
The text was updated successfully, but these errors were encountered:
Consider o1heap perhaps. It is also a constant-complexity, well-characterized allocator, but it doesn't make nontrivial assumptions about the target platform (such as limiting the memory alignment to the pointer size). I am obviously biased though because I am the author of that library, so beware.
The memory address allocated by the malloc function must be aligned twice void *, which means that for 64-bit system, 16-byte alignment is required, and for 32-bit system requires 8-byte alignment.
If you simply modify the macro definition, TLSF will crash directly. How to do this modification?
The text was updated successfully, but these errors were encountered: