free shrinkv resources earlier

Free the shrinkv line buffer and struct at the end of eval, not on image
dispose. This helps keep mem use down in some long-running operations.

Thank you homm, see https://github.com/libvips/pyvips/issues/147
This commit is contained in:
John Cupitt 2020-01-02 15:32:43 +00:00
parent be3775e868
commit 3b2c77dd35

View File

@ -124,6 +124,8 @@ vips_shrinkv_stop( void *vseq, void *a, void *b )
VipsShrinkvSequence *seq = (VipsShrinkvSequence *) vseq;
VIPS_FREEF( g_object_unref, seq->ir );
VIPS_FREE( seq->sum );
VIPS_FREE( seq );
return( 0 );
}
@ -137,14 +139,14 @@ vips_shrinkv_start( VipsImage *out, void *a, void *b )
VipsShrinkv *shrink = (VipsShrinkv *) b;
VipsShrinkvSequence *seq;
if( !(seq = VIPS_NEW( out, VipsShrinkvSequence )) )
if( !(seq = VIPS_NEW( NULL, VipsShrinkvSequence )) )
return( NULL );
seq->ir = vips_region_new( in );
/* Big enough for the largest intermediate .. a whole scanline.
*/
seq->sum = VIPS_ARRAY( out, shrink->sizeof_line_buffer, VipsPel );
seq->sum = VIPS_ARRAY( NULL, shrink->sizeof_line_buffer, VipsPel );
return( (void *) seq );
}