Adding allocator support to serialize_buffer