here is my code:
// the read func
vector<string> read(string file_name){
ifstream ifs(file_name, ifstream::in);
string line;
vector<string> company_names;
while(getline(ifs, line)){
company_names.push_back(line);
}
return company_names;
}
void test(){
vector<string> company = read("/home/yanwii/SocialCredits/CompanyName/company_names.txt");
vector<string>().swap(company);
}
int main(){
test();
}
After loading from file, in htop the program occupied 2G, then After swapping, the program still occupied 1G, what's going wrong?
Aucun commentaire:
Enregistrer un commentaire