From 74df307ca43df14b759fd9eb6a049a6c5d90dcda Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 2 Apr 2015 19:24:14 +0500 Subject: Cycles: Free unused image buffers when rendering with locked interface It is still possible to free a bit more memory by detecting buildin images which are not used by shaders, but that's not going to improve memory usage that much to bother about this now. Such change brings peak memory usage from 4.1GB to 3.4GB when rendering 01_01_01_D layout scene from the Gooseberry project. Mainly because of freeing memory used by rather huge environment map in the viewport. Reviewers: campbellbarton, juicyfruit Subscribers: eyecandy Differential Revision: https://developer.blender.org/D1215 --- source/blender/makesrna/intern/rna_image_api.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender') diff --git a/source/blender/makesrna/intern/rna_image_api.c b/source/blender/makesrna/intern/rna_image_api.c index b9a1237c1f2..7fb5885f709 100644 --- a/source/blender/makesrna/intern/rna_image_api.c +++ b/source/blender/makesrna/intern/rna_image_api.c @@ -288,6 +288,11 @@ static void rna_Image_filepath_from_user(Image *image, ImageUser *image_user, ch BKE_image_user_file_path(image_user, image, filepath); } +static void rna_Image_buffers_free(Image *image) +{ + BKE_image_free_buffers(image); +} + #else void RNA_api_image(StructRNA *srna) @@ -374,6 +379,9 @@ void RNA_api_image(StructRNA *srna) RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ RNA_def_function_output(func, parm); + func = RNA_def_function(srna, "buffers_free", "rna_Image_buffers_free"); + RNA_def_function_ui_description(func, "Free the image buffers from memory"); + /* TODO, pack/unpack, maybe should be generic functions? */ } -- cgit v1.2.3