Page MenuHome

Fix T92481: Memory leak with subdivision surface modifier
ClosedPublic

Authored by Campbell Barton (campbellbarton) on Nov 3 2021, 11:46 AM.

Details

Summary

Interpolation vertex data on loose edges was writing into already allocated data.

Resolve this by skipping vertex end-points for custom-data interpolation which has already been copied from the source mesh.

Diff Detail

Repository
rB Blender
Branch
TEMP-FIX-SUBSURF (branched from master)
Build Status
Buildable 18525
Build 18525: arc lint + arc unit

Event Timeline

Campbell Barton (campbellbarton) requested review of this revision.Nov 3 2021, 11:46 AM
Campbell Barton (campbellbarton) created this revision.
Sergey Sharybin (sergey) requested changes to this revision.Nov 5 2021, 10:24 AM
Sergey Sharybin (sergey) added inline comments.
source/blender/blenkernel/BKE_subdiv_foreach.h
109 ↗(On Diff #44296)

If you want to check for endpoints use u == 0.0f || v == 1.0f (similar to the corner vertex check).
Keep the foreach API simple, generic, and high level.

source/blender/blenkernel/intern/subdiv_mesh.c
1118–1122

Initialized != assigned to what it is supposed to be based on the interpolation and whatnot. The comment also doesn't mention where exactly the assignment happened.

For the endpoint which connects loose edge to the manifold it is quite clear where the interpolation happens. But it is unclear to me where interpolation of endpoint of edge which is not adjacent to the manifold happens.

This revision now requires changes to proceed.Nov 5 2021, 10:24 AM

Update based on feedback.

  • Remove additional u_index argument.
  • Note where the vertex data is initialized.
  • Remove custom-data copy calls for end-points (which are no longer needed).
Campbell Barton (campbellbarton) marked an inline comment as done.Nov 6 2021, 4:09 AM
Campbell Barton (campbellbarton) edited the summary of this revision. (Show Details)

Thanks for the clarifications!

This revision is now accepted and ready to land.Nov 8 2021, 9:37 AM