From 3b6a821105ecef6303a39253b4add6f1ab9e377c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Mon, 22 Apr 2024 01:26:48 +0200 Subject: [PATCH] kd-tree: Deallocate Point pointer vector after build(). This vector data; is no longer needed after being `.clear()`ed at the end of `build()`. This can save a good amount of memory, a `Point_d*` on a 64-bit system is 8 bytes; almost as large as a typical 3-float `Point_d`. There's no point keeping its capacity, since any call to `build()` will efficiently `.reserve()` it anyway. --- Spatial_searching/include/CGAL/Kd_tree.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Spatial_searching/include/CGAL/Kd_tree.h b/Spatial_searching/include/CGAL/Kd_tree.h index fb1819e1faad..cb1b63ae4d75 100644 --- a/Spatial_searching/include/CGAL/Kd_tree.h +++ b/Spatial_searching/include/CGAL/Kd_tree.h @@ -370,6 +370,7 @@ class Kd_tree { pts.swap(ptstmp); data.clear(); + data.shrink_to_fit(); built_ = true; }