views:

114

answers:

1

When the VC6 C runtime on XP can't serve an allocation request within an existing heap segment, it reserves a new segment. The size of these new segments increase by factors of 2 (until there are not large enough free areas to do that, at which point it falls down to smaller segments.)

In any case, is there any way to control this behavior on XP with the VC6 runtime? For example, doubling up to a point, but capping at 64MB segments.

If there is no way on XP but there is on 7, that would be good to know too. Or if there is no way on VC6 but there is on VC8 or up would be interesting.

+2  A: 

If you want specific allocation behaviour, write your own allocator. VirtualAlloc etc are there to help you do it. Using a compiler and CRT which is still in support would help too.

Stewart
This is the answer I was afraid of. But it seems to be the answer. Thanks.
Jason
The built in heap is not meant to be infinitely tunable. It is meant to be good enough for a very varied set of circumstances. If you need something special you often need to code it yourself on top of either VM or the heap. You don't specify why you need this behaviour, so it is difficult to give a full answer.Having said all of that, newer versions of VC don't implement their own heap, but instead use the OS heap, meaning you benefit from LFH and other advances.
Stewart