VC++ 2005 memory management functions  
Author Message
David Dunn

PostPosted: Visual C++ General, VC++ 2005 memory management functions Top

I posted the below on with no reply. I'd appreciate any feedback - the documentation is sparse on these issues.


We're about to make a major release. Recently I have been testing the
use of the low fragmentation heap that comes with Visual C++ 2005. We
ship libraries and in our release notes we would like to offer some
tips on how to developers integrating our components on how to get the
best performance.

Previously we recommended _set_sbh_threshold(1016) to improve
performance. Running our tests with the low fragmentation heap enabled
results in speed-ups in 99% of our tests. However a few of the tests
demonstrate severe speed degradation. In these we allocate of the order
of 100,000 small object (typically 72 bytes). If I enable the low
fragmentation heap AND call the _set_sbh_threshold() function, we seem
to recover the loss. However I cannot find any documentation that will
answer the following questions:

a) Is it possible to overflow the buckets in the low fragmenation heap
If so, what happens, and could it account for the slowdown

b) Are the calls for sbh and lfh compatible - will the objects be
allocated on different heaps at runtime Is it sane to call both

Any advice would be greatly appreciated.

David Dunn

Visual C++2