Search code examples
windowsvisual-c++memory-managementheap-memoryinternals

Triggering Lookaside lists


I am trying to make my application to use lookaside lists for memory management. I know the following details from various papers on this subject.

  1. Lookaside lists are located at offset +0x688 from the heap base
  2. Each member is 48 bytes long.
  3. lookasidelist[0],lookasidelist[1] not used.
  4. lookasidelist[n] block is of size n*8 and used to store (n-1)*8 byte blocks (remaining 8 bytes is used for header) and offset 0 points to a linked list containing free chunks of size (n-1)*8 terminating with null.
  5. Lookaside lists are enabled by default in XP SP3 and disabled in Vista/Win 7 systems(Low fragmentation heap is used in Vista/Win 7)

The problem that I am facing is that my application seems to not use Lookaside lists. No allocation seems to originate from lookaside lists and all the freed blocks are moved to freelist. Is there a particular compiler flag or a condition needs to be satisfied in order for the applications to use lookaside lists? Application is compiled in Microsoft Visual C++ 2010 express edition and is tested under Windows XP SP3. I am using immunity debugger for verifying if lookaside lists are being used. If there is a better way do let me know.


Solution

  • Instead of running the process through debugger, attaching to the process at runtime revealed that the application decides to use lookaside lists when it is not being debugged. This is the only place I have seen it documented.

    The heap manager creates look-aside lists automatically when a heap is created, as long as no debugging options are enabled and the heap is expandable.