From 531bc5ca6999c1938ecfe2f73f85b825275294da Mon Sep 17 00:00:00 2001 From: Sean Kim Date: Tue, 1 Jul 2025 19:07:10 +0200 Subject: [PATCH] Fix: SubdivCCG uses 2x as much memory as needed for edge adjacency On a Suzanne mesh with 125k faces subdivided at level 3, this patch results in a 40MB savings of memory, from 1.24 GB measured in Blender itself to 1.20 GB with this patch applied. Pull Request: https://projects.blender.org/blender/blender/pulls/141167 --- source/blender/blenkernel/intern/subdiv_ccg.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/blenkernel/intern/subdiv_ccg.cc b/source/blender/blenkernel/intern/subdiv_ccg.cc index 3d9dd8f2aa8..22b3e868616 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.cc +++ b/source/blender/blenkernel/intern/subdiv_ccg.cc @@ -262,7 +262,7 @@ static SubdivCCGCoord *subdiv_ccg_adjacent_edge_add_face(SubdivCCG &subdiv_ccg, MEM_reallocN(adjacent_edge.boundary_coords, adjacent_edge.num_adjacent_faces * sizeof(*adjacent_edge.boundary_coords))); adjacent_edge.boundary_coords[adjacent_face_index] = MEM_malloc_arrayN( - grid_size * 2, "ccg adjacent boundary"); + grid_size, "ccg adjacent boundary"); return adjacent_edge.boundary_coords[adjacent_face_index]; }