Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2016-02-07 01:40:41 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2016-02-12 17:43:26 +0300
commitc8d2bc78902422c89607a5778857de958e3bb837 (patch)
tree73355a2912eb64be5ecbe52f2d42b1da60d10f0c /intern/cycles/util/util_vector.h
parent28604c46a137c1288cc7a494b36ed72e44a0ab8b (diff)
Cycles: Always use guarded allocator of vectors
We don't have vectors re-allocation happening multiple times from inside a loop anymore, so we can safely switch to a memory guarded allocator for vectors and keep track on the memory usage at various stages of rendering. Additionally, when building from inside Blender repository, Cycles will use Blender's guarded allocator, so actual memory usage will be displayed in the Space Info header. There are couple of tricky aspects of the patch: - TaskScheduler::exit() now explicitly frees memory used by `threads`. This is needed because `threads` is a static member which destructor isn't getting called on Blender's exit which caused memory leak print to happen. This shouldn't give any measurable speed issues, reallocation of that vector is only one of fewzillion other allocations happening during synchronization. - Use regular guarded malloc (not aligned one). No idea why it was made to be aligned in the first place. Perhaps some corner case tests or so. Vector was never expected to be aligned anyway. Let's see if we'll have actual bugs with this. Reviewers: dingto, lukasstockner97, juicyfruit, brecht Reviewed By: brecht Differential Revision: https://developer.blender.org/D1774
Diffstat (limited to 'intern/cycles/util/util_vector.h')
-rw-r--r--intern/cycles/util/util_vector.h15
1 files changed, 3 insertions, 12 deletions
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h
index 623436483a0..830aa15291d 100644
--- a/intern/cycles/util/util_vector.h
+++ b/intern/cycles/util/util_vector.h
@@ -24,30 +24,21 @@
#include <vector>
#include "util_aligned_malloc.h"
+#include "util_guarded_allocator.h"
#include "util_types.h"
-#ifdef WITH_CYCLES_DEBUG
-# include "util_guarded_allocator.h"
-#endif
-
CCL_NAMESPACE_BEGIN
/* Vector
*
* Own subclass-ed vestion of std::vector. Subclass is needed because:
*
- * - When building with WITH_CYCLES_DEBUG we need to use own allocator which
- * keeps track of used/peak memory.
+ * - Use own allocator which keeps track of used/peak memory.
*
* - Have method to ensure capacity is re-set to 0.
*/
template<typename value_type,
-#ifdef WITH_CYCLES_DEBUG
- typename allocator_type = GuardedAllocator<value_type>
-#else
- typename allocator_type = std::allocator<value_type>
-#endif
- >
+ typename allocator_type = GuardedAllocator<value_type> >
class vector : public std::vector<value_type, allocator_type>
{
public: