Refactor: Replace malloc topic_offset/label/hist with std::vector