From 02213b867ed68a00683fa931ebce12a23ed3e77b Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 20 Apr 2016 16:15:11 +0200 Subject: Cycles: Stop rendering when bad_alloc happens This is an attempt to gracefully handle out-of-memory events and stop rendering with an error message instead of a crash. It uses bad_alloc exception, and usually i'm not really fond of exceptions, but for such limited use for errors from which we can't recover it should be fine. Ideally we'll need to stop full Cycles Session, so viewport render and persistent images frees all the memory, but that we can support later, since it'll mainly related on telling Blender what to do. General rules are: - Use as less exception handles as possible, try to find a most geenric pace where to handle those. For example, ccl::Session. - Threads needs own handling, exception trap from one thread will not catch exceptions from other threads. That's why BVH build needs own thing. Reviewers: brecht, juicyfruit, dingto, lukasstockner97 Differential Revision: https://developer.blender.org/D1898 --- intern/cycles/render/session.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'intern/cycles/render/session.cpp') diff --git a/intern/cycles/render/session.cpp b/intern/cycles/render/session.cpp index 24f48b61349..63037311889 100644 --- a/intern/cycles/render/session.cpp +++ b/intern/cycles/render/session.cpp @@ -816,7 +816,7 @@ void Session::update_scene() /* update scene */ if(scene->need_update()) { progress.set_status("Updating Scene"); - scene->device_update(device, progress); + MEM_GUARDED_CALL(&progress, scene->device_update, device, progress); } } -- cgit v1.2.3