On the humor/obscurity aspect, GNU wins with _memfrob
:
DESCRIPTION
The memfrob() function encrypts the first n bytes of the memory area s
by exclusive-ORing each character with the number 42. The effect can
be reversed by using memfrob() on the encrypted memory area.
A somewhat more useful function, though only on Win32, is _heapwalk
from the Microsoft C library. To dump the heap contents:
void heapdump()
{
_HEAPINFO hinfo;
int heapstatus;
hinfo._pentry = NULL;
while ((heapstatus = _heapwalk(&hinfo)) == _HEAPOK)
printf( "%6s block at %Fp of size %4.4X\n", (hinfo._useflag == _USEDENTRY ? "USED" : "FREE" ), hinfo._pentry, hinfo._size);
switch (heapstatus) {
case _HEAPEMPTY: printf( "OK - empty heap\n" ); break;
case _HEAPEND: printf( "OK - end of heap\n" ); break;
case _HEAPBADPTR:printf( "ERROR - bad pointer to heap\n" ); break;
case _HEAPBADBEGIN: printf( "ERROR - bad start of heap\n" ); break;
case _HEAPBADNODE: printf( "ERROR - bad node in heap\n" ); break;
}
}