Refactor: Replace malloc ranges with std::vector