共用方式為


Allocating aligned memory in Windows

A question came up on an internal alias about allocating memory blocks along page alignments, and it was harder than I expected to find the answer.  So here is the link to _aligned_malloc
 on MSDN
, and now Google can work its magic.

https://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/vclrf_aligned_malloc.asp

_aligned_malloc
Allocates memory on a specified alignment boundary.

Comments

  • Anonymous
    July 20, 2004
    If _aligned_malloc didn't exist, do you think it would be difficult to write a function that does the same yourself? I hope you can't pass a Microsoft job interview if you do. :)
  • Anonymous
    June 07, 2005
    Thanks a lot, This is really a great help and has saved my lot of time.