Changeset 218 in tmcsimulator for branches


Ignore:
Timestamp:
11/02/2017 11:08:15 PM (8 years ago)
Author:
jtorres
Message:

branches/FEPSimulator/HighwaysParser.cpp: garbage collection implemented. We are now deallocating all allocated memory. See: HighwaysParser::~HighwaysParser? (destructor). It will be called whenever the HighwaysParser? object goes out of scope in FEPSim::sendReplys.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/FEPSimulator/HighwaysParser.cpp

    r217 r218  
    2525 
    2626HighwaysParser::~HighwaysParser() { 
     27    // deallocate FEPLines 
     28    for(int i = 0; i < this->lines.size(); i++) 
     29    { 
     30        delete this->lines.at(i); 
     31    } 
     32    // deallocate stations 
     33    for(int i = 0; i < this->stations.size(); i++) 
     34    { 
     35        // deallocate loops 
     36        for(int j = 0; j < this->stations.at(i)->loops.size(); j++) 
     37        { 
     38            // deallocate loop_loc 
     39            delete this->stations.at(i)->loops.at(j)->loop_loc; 
     40            // deallocate loop 
     41            delete this->stations.at(i)->loops.at(j); 
     42        } 
     43        // deallocate station dataPack message 
     44        delete this->stations.at(i)->dataPack; 
     45        // deallocate station 
     46        delete this->stations.at(i); 
     47    } 
    2748} 
    2849 
Note: See TracChangeset for help on using the changeset viewer.