System::~System()
{
while (Variable* var = extract_variable()) {
- std::string demangled = boost::core::demangle(var->id_ ? typeid(*var->id_).name() : "(unidentified)");
- XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.", demangled.c_str(),
- var->rank_);
+ const char* name = var->id_ ? typeid(*var->id_).name() : "(unidentified)";
+ boost::core::scoped_demangled_name demangled(name);
+ XBT_WARN("Probable bug: a %s variable (#%d) not removed before the LMM system destruction.",
+ demangled.get() ? demangled.get() : name, var->rank_);
var_free(var);
}
while (Constraint* cnst = extract_constraint())
{
/* All actors should be gone when the host is turned off (by the end of the simulation). */
if (not actor_list_.empty()) {
- std::string msg = "Shutting down host, but it's not empty:";
- for (auto const& actor : actor_list_)
- msg += "\n\t" + std::string(actor.get_name());
-
- EngineImpl::get_instance()->display_all_actor_status();
- xbt_die("%s", msg.c_str());
+ const char* msg = "Shutting down host, but it's not empty";
+ try {
+ std::string actors;
+ for (auto const& actor : actor_list_)
+ actors += "\n\t" + std::string(actor.get_name());
+
+ EngineImpl::get_instance()->display_all_actor_status();
+ xbt_die("%s:%s", msg, actors.c_str());
+ } catch (std::bad_alloc& ba) {
+ xbt_die("%s (cannot print actor list: %s)", msg, ba.what());
+ }
}
for (auto const& arg : actors_at_boot_)
delete arg;