tcmalloc_test: Expand memory alloc functions tested, work with optimized build.
tcmalloc_test: Expand memory alloc functions tested, work with optimized build.

Expand to test that all the memory allocation functions used by
memcached are correctly tracked using mem_used. Also update tcmalloc_test
to work with optimized build:

- Change assert() to cb_assert()

- alloc_size is accessed from multiple thread so make atomic.

- Store return value from malloc() in a non-local variable to prevent
  compiler dead-code elimination from eliding calls to malloc/free.

Change-Id: Id2c17652fa50cd215eab560877165a4efffea099
Reviewed-on: http://review.couchbase.org/42520
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>

daverigby/memcached,daverigby/memcached,daverigby/kv_engine,couchbase/memcached,cloudrain21/memcached-1,daverigby/kv_engine,mrkwse/memcached,mrkwse/memcached,daverigby/memcached,jimwwalker/memcached,couchbase/memcached,couchbase/memcached,owendCB/memcached,mrkwse/memcached,owendCB/memcached,owendCB/memcached,cloudrain21/memcached-1,cloudrain21/memcached-1,jimwwalker/memcached,jimwwalker/memcached,daverigby/kv_engine,cloudrain21/memcached-1,daverigby/memcached,daverigby/kv_engine,mrkwse/memcached,owendCB/memcached,couchbase/memcached