5.5.3 Locality Comparison

Locality is a characteristic of the combination of the confidence test code proper and the library routines that HeapTest calls to manage the heap. Although the heap calls are effectively random, the test program does access memory (to pattern it) just after it allocates it, as the native heap has every right to expect. The test program also accesses allocated memory just before freeing it (to validate the pattern). This means that the test program is not capable of bringing out the page-fault advantage that LeapHeap has with certain applications, mentioned near the end of section 5.3 Locality. Anyway, the pattern writing and checking constitute the most intensive locality of the program, but this is of course the same whichever heap manager is used.

The locality that matters, that can distinguish the heap managers, is (loosely defined) the probability that consecutive heap operations address the same memory page. This will be low for the native heap, as its heap area is a jumble of different sizes. It will also be low for LeapHeap, because HeapTest is an atypical program which chooses its allocation sizes randomly. The only advantage LeapHeap can summon is through thread-based bit preference, described in section 4.1 Compartment Area Implementation : a thread performs many thousands of heap operations during each time-slice for which it is scheduled, and these operations will be directed at the relatively small areas of memory controlled by the preferred bit.

In any case, the locality of the HeapTest program cannot be varied parametrically, so locality effects have to be inferred rather than measured.