[Bf-blender-cvs] [cc0c94d] master: Switch allocator to thread-safe when rendering from the command line

Sergey Sharybin noreply at git.blender.org
Tue Jun 24 10:18:32 CEST 2014


Commit: cc0c94d535e4c0ee322876f6e6c7bd271f5316fa
Author: Sergey Sharybin
Date:   Tue Jun 24 14:12:28 2014 +0600
https://developer.blender.org/rBcc0c94d535e4c0ee322876f6e6c7bd271f5316fa

Switch allocator to thread-safe when rendering from the command line

This is needed because render threads would do some allocations like
part buffer allocation and so. This is likely harmless with the lock
free allocator (not on Windows tho), but when using guarded allocator
we need to be sure access to the list of MemHead is safe.

===================================================================

M	source/creator/creator.c

===================================================================

diff --git a/source/creator/creator.c b/source/creator/creator.c
index 1183702..b42c533 100644
--- a/source/creator/creator.c
+++ b/source/creator/creator.c
@@ -1001,6 +1001,7 @@ static int render_frame(int argc, const char **argv, void *data)
 					break;
 			}
 
+			BLI_begin_threaded_malloc();
 			BKE_reports_init(&reports, RPT_PRINT);
 
 			frame = CLAMPIS(frame, MINAFRAME, MAXFRAME);
@@ -1008,6 +1009,7 @@ static int render_frame(int argc, const char **argv, void *data)
 			RE_SetReports(re, &reports);
 			RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, frame, frame, scene->r.frame_step);
 			RE_SetReports(re, NULL);
+			BLI_end_threaded_malloc();
 			return 1;
 		}
 		else {
@@ -1029,10 +1031,12 @@ static int render_animation(int UNUSED(argc), const char **UNUSED(argv), void *d
 		Main *bmain = CTX_data_main(C);
 		Render *re = RE_NewRender(scene->id.name);
 		ReportList reports;
+		BLI_begin_threaded_malloc();
 		BKE_reports_init(&reports, RPT_PRINT);
 		RE_SetReports(re, &reports);
 		RE_BlenderAnim(re, bmain, scene, NULL, scene->lay, scene->r.sfra, scene->r.efra, scene->r.frame_step);
 		RE_SetReports(re, NULL);
+		BLI_end_threaded_malloc();
 	}
 	else {
 		printf("\nError: no blend loaded. cannot use '-a'.\n");




More information about the Bf-blender-cvs mailing list