I've been reading the legacy code,which invloves in the customized memory pooling system, then I found that the code uses _aligned_malloc. I wonder what is this function and when do I have to use it.
Thanks all of you.
I did read MSDN but what I wanted was the answer like "An example of a reason for wanting a certain alignment is to use the data with the SSE instruction set on x86 where the data must be aligned to a multiple 16".
I finally understood what those code means. thanks again.
This function is useful when the alignment of your memory allocation is important to you.
Alignment means that the numerical value of the pointer returned must be evenly divisible by a certain number, ie. ((unsigned int)ptr) % alignment
should evaluate to 0.
An example of a reason for wanting a certain alignment is to use the data with the SSE instruction set on x86 where the data must be aligned to a multiple 16.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With