I\'m trying to understand what functions memalign()
and posix_memalign()
do. Reading the available documentation didn\'t help.
Can someone
Deffault malloc return pointer that are multiple of 8, It's mean malloc split memory to chunks have 8 bytes and check free memory at start of each chunk. There are 2 faces of problem.
Larger chunk will waste more memory, but larger chunk help C find free chunk memory faster. memalign can change how big those chunk is. If you want to save memory, decrease chunk's size to 2 or 4. If you want to make your application faster, increase chunk's size to power of 2.