diff --git a/mindspore/ccsrc/dataset/util/arena.cc b/mindspore/ccsrc/dataset/util/arena.cc index 68673529ffefaa4cbeab986834f63c45dd641f6c..51de281d507b705345ed47ec5ad23593c3cb6ef8 100644 --- a/mindspore/ccsrc/dataset/util/arena.cc +++ b/mindspore/ccsrc/dataset/util/arena.cc @@ -52,7 +52,7 @@ Status Arena::Allocate(size_t n, void **p) { // Round up n to 1K block uint64_t req_size = static_cast(n) + ARENA_WALL_OVERHEAD_SZ; if (req_size > this->get_max_size()) { - RETURN_STATUS_UNEXPECTED("Request size too big : " + std::to_string(n)); + return Status(StatusCode::kOutOfMemory); } uint64_t reqBlk = SizeToBlk(req_size); // Do a first fit search diff --git a/mindspore/ccsrc/dataset/util/intrp_service.cc b/mindspore/ccsrc/dataset/util/intrp_service.cc index 85b56ec00ec7ef03c090fcec023be0be9d751009..4ccb5bd0a5b92359f30af74ddd0ae910f67a8d0c 100644 --- a/mindspore/ccsrc/dataset/util/intrp_service.cc +++ b/mindspore/ccsrc/dataset/util/intrp_service.cc @@ -46,7 +46,10 @@ Status IntrpService::Register(const std::string &name, IntrpResource *res) { std::ostringstream ss; ss << this_thread::get_id(); MS_LOG(DEBUG) << "Register resource with name " << name << ". Thread ID " << ss.str() << "."; - (void)all_intrp_resources_.emplace(name, res); + auto it = all_intrp_resources_.emplace(name, res); + if (it.second == false) { + return Status(StatusCode::kDuplicateKey, __LINE__, __FILE__, name); + } high_water_mark_++; } catch (std::exception &e) { RETURN_STATUS_UNEXPECTED(e.what());