Description
Context
In buckets.h (http://src.couchbase.org/source/xref/trunk/kv_engine/daemon/buckets.h#158-161) we maintain an array of statistics for each thread which accesses the bucket.
The size of the array is determined at runtime based on how many front-end memcached threads have been configured - see http://src.couchbase.org/source/xref/trunk/kv_engine/daemon/memcached.cc#2297
Currently, the bucket.stats array is implemented using a manually-managed dynamic array - new[] to create it. This is against our current best-practices (and current C++ best practices) - the user must remember to call delete[] to free the memory, if they don't then it cause a memory leak.
Is is better if we use a standard container class - such as std::vector to manage such resource - this will automatically free the data when it goes out of scope and is hence less error-prone.
Task
Change the implementation of bucket.stats to use std::vector instead of a raw pointer / new[]. This will require changing the type definition in buckets.h, changing where it's created / resized. Actual uses of the variable (i.e. reading elements) should stay the same.