Move memory allocation and free out of the critical sections in cache.cc
Move memory allocation and free out of the critical sections in cache.cc

This is a port of the following two commits from rocksdb:

fa46ddb41f96f5200425978a9b9b7834df30b6bb
e8d40c31b3cca0c3e1ae9abe9b9003b1288026a9

We currently don't have a good benchmark to show an improvement.

Change-Id: Ie061c43ccf80427f0fa63f94ceb4a55ea94f3b32
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/4544
Tested-by: jenkins
Reviewed-by: Todd Lipcon <2c763d726a8c2f6afda9be7e0e56a2caa6bb5e6b@cloudera.com>

cloudera/kudu,helifu/kudu,helifu/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,helifu/kudu,andrwng/kudu,cloudera/kudu,InspurUSA/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,InspurUSA/kudu,cloudera/kudu,InspurUSA/kudu,InspurUSA/kudu,cloudera/kudu,andrwng/kudu,cloudera/kudu,EvilMcJerkface/kudu,andrwng/kudu,InspurUSA/kudu,andrwng/kudu,andrwng/kudu,andrwng/kudu,EvilMcJerkface/kudu,helifu/kudu,EvilMcJerkface/kudu,helifu/kudu,InspurUSA/kudu,cloudera/kudu,helifu/kudu,helifu/kudu,InspurUSA/kudu,helifu/kudu,EvilMcJerkface/kudu,cloudera/kudu,andrwng/kudu,andrwng/kudu,helifu/kudu,andrwng/kudu,cloudera/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,cloudera/kudu