这是我的代码。我得到错误双重免费或腐败(fasttop)c ++
//iterations
for (int iter=0;iter<iterations;iter++) {
printf("Iteration %d\n",iter);
printf("\tStreaming Edges\n");
//for each edge which the source has a label but the destination has not.
//Assign the label to the matrix
graph.stream_edges<VertexId>(
[&](Edge & e){
if ((vertices_labels[e.source]>=0) && (vertices_labels[e.target]<0)){
aux_labels[e.target].push_back(vertices_labels[e.source]);
}
return 0;
}, nullptr, 0, 1
);
printf("\tStreaming Nodes\n");
//get the most predominant vertice in the matrix
graph.stream_vertices<VertexId>(
[&](VertexId i){
if (vertices_labels[i]<0){
int maxCount = -1;
int result = -1;
for (int j=0;j<aux_labels[i].size();j++){
int value = aux_labels[i].at(j);
int c = 1;
for (int k=j+1;k<aux_labels[i].size();k++){
if (aux_labels[i].at(k)==value){
c++;
if (c>maxCount){
maxCount = c;
result = aux_labels[i].at(k);
}
}
}
}
write_add(&vertices_labels[i], result+1);
}
return 0;
}
);
}
有人可以告诉我问题可能出在哪里?附:我正在使用大矢量。当我尝试在我的虚拟盒子里面的Linux中运行它时,运行正常。但是当我尝试运行Linux机器时,它给了我错误(双重免费或损坏(fasttop))。我相信它可能发生在真机上,因为它可能是并发的。欢迎任何建议或见解!