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 <build@couchbase.com>
Reviewed-by: Trond Norbye <trond.norbye@gmail.com>