MB-16056: Stats: Improve memory allocation failure handling
MB-16056: Stats: Improve memory allocation failure handling

Improve the memory allocation failure handling during stats
calculation, by:

a) Reducing the number of memory allocations required - use fixed size
   stack allocations which converting numbers to strings.

b) Check for std::bad_alloc exceptions and propogate back to the
   client as ENOMEM.

Change-Id: I6bf78e152f6feac97db6fc4f1abe34a52ff8a4b2
Reviewed-on: http://review.couchbase.org/55046
Reviewed-by: Jim Walker <1cd02e31b43620d7c664e038ca42a060d61727b9@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>

owendCB/memcached,owendCB/memcached,owendCB/memcached,couchbase/memcached,daverigby/memcached,daverigby/memcached,daverigby/kv_engine,daverigby/kv_engine,daverigby/kv_engine,couchbase/memcached,owendCB/memcached,daverigby/memcached,couchbase/memcached,daverigby/kv_engine,daverigby/memcached,couchbase/memcached