title: Page boundaries, implementing memory pool
body: <p>I have decided to reinvent the wheel for a millionth time and write my own memory pool. My only question is about page size boundaries.</p>
  
  <p>Let's say GetSystemInfo() call tells me that the page size is 4096 bytes. Now, I want to preallocate a memory area of 1MB (could be smaller, or larger), and divide this area into 128 byte blocks. HeapAlloc()/VirtualAlloc() will have an overhead between 8 and 16 bytes I guess. Might be some more, I've read posts talking about 60 bytes.</p>
  
  <p>Question is, do I need to pay attention to not to have one of my 128 byte blocks across page boundaries?</p>
  
  <p>Do I simply allocate 1MB in one chunk and divide it into my block size?</p>
  
  <p>Or should I allocate many blocks of, say, 4000 bytes (to take into account HeapAlloc() overhead), and sub-divide this 4000 bytes into 128 byte blocks (4000 / 128 = 31 blocks, 128 bytes each) and not use the remaining bytes at all (4000 - 31x128 = 32 bytes in this example)?</p>