mirror of https://github.com/CGAL/cgal
Corrected memory issue using Scott Meyer's "swap trick" to trim excess capacity
This commit is contained in:
parent
50e4e67739
commit
593a5a8be3
|
|
@ -29,6 +29,9 @@ int main(void)
|
||||||
removed_percentage),
|
removed_percentage),
|
||||||
points.end());
|
points.end());
|
||||||
|
|
||||||
|
// Optional: Scott Meyer's "swap trick" to trim excess capacity
|
||||||
|
std::vector<Point>(points).swap(points);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ void test_avg_knn_sq_distance(std::deque<Point>& points, // input point set
|
||||||
removed_percentage),
|
removed_percentage),
|
||||||
points.end());
|
points.end());
|
||||||
|
|
||||||
|
// Optional: Scott Meyer's "swap trick" to trim excess capacity
|
||||||
|
std::deque<Point>(points).swap(points);
|
||||||
|
|
||||||
|
|
||||||
long memory = CGAL::Memory_sizer().virtual_size();
|
long memory = CGAL::Memory_sizer().virtual_size();
|
||||||
std::cerr << "ok: " << task_timer.time() << " seconds, "
|
std::cerr << "ok: " << task_timer.time() << " seconds, "
|
||||||
<< (memory>>20) << " Mb allocated"
|
<< (memory>>20) << " Mb allocated"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue