making the allocator thread-safe