0

是否存在与 tinyXML 相关的固有内存泄漏问题?我不知道为什么我会遇到这个奇怪的段错误。在下面的函数中,每当我尝试增加元素名称(“Connecor”和“laneFro”)的大小时,下面的 if 子句(在循环中)都会导致程序崩溃。

void WriteXMLInput_Node_Connectors(Node* node,TiXmlElement * Node_)
{
    std::ostringstream out;
    TiXmlElement * Connectors = new TiXmlElement("Connectors"); Node_->LinkEndChild(Connectors);
    TiXmlElement * Connector;
    TiXmlElement * laneFrom;
    TiXmlElement * laneTo;

    for(std::map<const sim_mob::Lane*, sim_mob::Lane* >::const_iterator it = node->getConnectors().begin();it != (node->getConnectors().end()); it++)
    {
        Connector = new TiXmlElement("Connecor"); Connectors->LinkEndChild(Connector);
        laneFrom = new TiXmlElement("laneFro"); Connector->LinkEndChild(laneFrom);
//      laneTo = new TiXmlElement("laneTo"); Connector->LinkEndChild(laneTo);
        if(42792 == node->getID())
        {
            std::cout << "uninode " ;
            std::cout << uninode->getID();
            std::cout << " from: " << (*it).first << " ";
            std::cout << (*it).first->getLaneID_str();
            std::cout << "uninode " << uninode->getID() << " To: " << (*it).second->getLaneID_str();

    }
}

谢谢

4

0 回答 0