Fix T75121: Memory leak in Surface Smooth
The brush was allocating new memory for storing the displacemnets at the beginning of each stroke step and not freeing them. Reviewed By: jbakker Maniphest Tasks: T75121 Differential Revision: https://developer.blender.org/D7254
This commit is contained in:
parent
43f748a32f
commit
6cc4c68dad
Notes:
blender-bot
2023-02-14 03:21:27 +01:00
Referenced by issue #75121, High RAM usage by Surface smooth brush.
|
@ -3458,7 +3458,9 @@ static void do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in
|
|||
Brush *brush = BKE_paint_brush(&sd->paint);
|
||||
SculptSession *ss = ob->sculpt;
|
||||
|
||||
if (ss->cache->mirror_symmetry_pass == 0 && ss->cache->radial_symmetry_pass == 0) {
|
||||
if (ss->cache->first_time && ss->cache->mirror_symmetry_pass == 0 &&
|
||||
ss->cache->radial_symmetry_pass == 0) {
|
||||
BLI_assert(ss->cache->surface_smooth_laplacian_disp == NULL);
|
||||
ss->cache->surface_smooth_laplacian_disp = MEM_callocN(
|
||||
SCULPT_vertex_count_get(ss) * 3 * sizeof(float), "HC smooth laplacian b");
|
||||
}
|
||||
|
@ -6860,9 +6862,9 @@ static const char *sculpt_tool_name(Sculpt *sd)
|
|||
|
||||
void SCULPT_cache_free(StrokeCache *cache)
|
||||
{
|
||||
if (cache->dial) {
|
||||
MEM_freeN(cache->dial);
|
||||
}
|
||||
MEM_SAFE_FREE(cache->dial);
|
||||
MEM_SAFE_FREE(cache->surface_smooth_laplacian_disp);
|
||||
|
||||
if (cache->pose_ik_chain) {
|
||||
SCULPT_pose_ik_chain_free(cache->pose_ik_chain);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue