issue-612: added missing include for std::min

Otherwise Visual Studio 2013 rightfully complains
issue-613: remove friend declaration from HeapLeakChecker

This applies patch by davide.italiano@10gen.com:

heap-checker.h contains the following friend declaration of main:
friend int main(int, char**).

C99 allows another declaration of main, i.e. int main(int, char**,
char**), and if code uses it and includes the heap-checker header,
this might result in a conflict, e.g.

error: declaration of C function 'int main(int, char**, char**)' conflicts with
 int main(int argc, char* argv[], char** envp)

Actually the comment above the friend declaration of main() mentions
that this is required to get the unittest working and for other
internal usage, but I'm not completely sure if this is true as long as
I'm able to build and run the unittest removing the declaration.
Fix getpc_test for PPC64v2 LE

This patch fix the PPC64 guard to get the function address for PPC64v2.
It removes the use of an indirection (to get the ODP text address),
since the PPCv2 does not have function descriptors.
speed up MallocExtension::instance()

It was reported that pthread_once is expensive, especially on ppc.

In new implementation in hot path instead of doing potentially
expensive atomic read with barrier, we do just plain read.

It's slightly less robust than older implementation, but it should be
faster.

New code is making assumption that programs do not spawn threads
before main() is called. And therefore all variables & modules are
initialized before threads are created. Which looks like pretty safe
assumption. With that assumption, doing plain read is safe, because
current_instance is initialized as part of module init and therefore
before threads are spawned.

This patch is based on feedback of Adhemerval Zanella.
eliminated CheckIfKernelSupportsTLS

We don't care about pre-2.6.0 kernels anymore. So we can assume that
if compile time check worked, then at runtime it'll work.
avoid recursion in backtrace()
extended low_level_alloc

By adding ability to customize pages allocator
implemented emergency malloc