
*** I have moved functions and static vars around to place the close
    together and only when needed

*** I have put a lock around a larger fraction of psRealloc since it
    was potentially hitting a race condition for hold of
    lastMemBlockAllocated

*** I removed some nonsensical code in psRealloc (eg, if (X == Y) { Y = X; })
    and cleaned up the memBlock reference mods to they are more readable.

*** WHY do we modify p_psMemAllocID after hitting memAllocCallback???
    this makes no sense to me.

*** does get psMemIncrRefCounter really need to lock?  only if
    p_psMemAllocID is being modified, which makes no sense to me (see
    above).
