Memory Management/Valid Pointer Detection

Key to performing a memory trace is finding pointers to managed memory objects. If pointers to the object are not found, an uncooperative garbage collector will mark the object as dead and will reclaim the space for later reallocation. Places such as the processor registers and the system call stack need to be examined to find all potential pointers to managed memory objects.

Pointer or Data
When looking at an arbitrary bit pattern, there is no way to determine whether the value is a pointer to a memory location or an integer value. However, most garbage collectors take the conservative approach and assume that all values that could be valid pointers are treated as valid pointers. If the memory management system is allocating memory in pages, it's a trivial task to determine whether a value could be a pointer to an object inside that page. Looping over all pages in this manner will determine whether a given binary value is a pointer to any managed memory objects.