January 19th, 2013, 02:12 AM
Low level memory allocation
I found myself reading this article at StackOverflow when I encountered a problem in our code with a variable that we'd allocated using boost::fast_pool_allocator. It turned out that the problem was in our own code so the boost connection was just a red herring but it got me wondering....
One of the commentators in that article mentions that performance-wise, boost::fast_pool_allocator isn't particularly fast and this got me wondering about how the Windows heap manager allocates memory. If I malloc (say) 3 x chars, surely the heap manager doesn't examine the heap each time to find the next available free byte? I'd imagine that when I first ask for a char, it allocates some kind of pool from which it can allocate later bytes much more quickly (i.e. exactly what boost::fast_pool_allocator does).
That's only a guess but it seems like the kind of strategy tht a modern OS would probably employ. Just curious to know if that's what happens in practice?
"A problem well stated is a problem half solved.” - Charles F. Kettering
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.