Handmade Hero»Forums»Code
Shazan Shums
158 posts
Some day I will make quality software. Programming FTW.
Memory allocation
Edited by Shazan Shums on
What are the pros and cons of using virtual memory like pages in win32 than heap memory allocation and wise versa. Is it possible to use malloc instead of virtual alloc in arena based memory allocation if so how to do and what are is the cost of doing so.
498 posts
Memory allocation
malloc will itself have to fall back on VirtualAlloc to get the actual memory it passes back.

On top of that it will do a bit of bookkeeping to track the unused free space that subsequent allocation may be able to use.

So what you are losing is a bit of performance on each call to alloc. (especially when the chunks you request are larger than malloc keeps enough space around for)