question about FrameArena

I was looking at the HH source for the first time in a while and noticed that FrameArena seems to be dynamically allocating and de-allocating (using platform calls to virtualalloc/free) all of its memory every frame. I thought one of the points of using big chunk allocations was to avoid that kind of overhead but with this implementation wouldn't the frame arena have to make a lot of platform allocations if a lot of memory is needed(which often is the case for frame memory)? What am I missing?

Edited by Gus Waldo on
The frame arena only uses a few blocks of memory (6 allocations on my quick test). So it's not really an issue.
If at some point we saw that becoming an issue, we could allocate larger blocks (I believe the default size now is 1Mo per block) or keep the blocks in a free list or something like that. But most of the "persistent" memory (not the FrameArena) in HMH is allocated once and then kept until we close the program.
that makes sense and I guess Casey will continue to tune the memory allocations. In my own code I initialize a persistent chunk for my frame-arena, but it still has the ability to automatically allocate and deallocate additional chunks on top of that if needed.