- usedSize_ = 0;
- if ((not filename) || (strcmp(filename, "") == 0))
- return nullptr;
-
- std::map<std::string, sg_size_t*>* parse_content = new std::map<std::string, sg_size_t*>();
-
- std::ifstream* fs = surf_ifsopen(filename);
-
- std::string line;
- std::vector<std::string> tokens;
- do {
- std::getline(*fs, line);
- boost::trim(line);
- if (line.length() > 0) {
- boost::split(tokens, line, boost::is_any_of(" \t"), boost::token_compress_on);
- xbt_assert(tokens.size() == 2, "Parse error in %s: %s", filename, line.c_str());
- sg_size_t size = std::stoull(tokens.at(1));
-
- usedSize_ += size;
- sg_size_t* psize = new sg_size_t;
- *psize = size;
- parse_content->insert({tokens.front(), psize});
- }
- } while (not fs->eof());
- delete fs;
- return parse_content;
+ if (not currentlyDestroying_) {
+ currentlyDestroying_ = true;
+ s4u::Storage::on_destruction(this->piface_);
+ delete this;
+ }