Problem: proxy switch code isn't minimal

Solution: simplify it a little more.
Problem: need a way to count zmallocs in a multithreaded app

Given that mallocs/frees are the most common cost in a high volume
app, it would be useful to get a rapid indicator of the total number
of allocations made (assume every alloc has a matching free and this
is checked with valgrind).

Solution: count mallocs in a process-global variable.

Note: done for GCC / Linux only in this instance, where we have the
necessary atomics.