simple c version of thread caching allocator