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
This commit is contained in:
Sean Kim
2025-07-01 19:07:10 +02:00
committed by Sean Kim
parent 5b89f6d973
commit 531bc5ca69

View File

@@ -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<SubdivCCGCoord>(
grid_size * 2, "ccg adjacent boundary");
grid_size, "ccg adjacent boundary");
return adjacent_edge.boundary_coords[adjacent_face_index];
}