a thread-safe memory pool, which allocates memories of a pre-given length