diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-14 18:49:20 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2015-02-15 00:01:48 +0300 |
commit | d0cc1180b0d28cd988d1c2f225524c15aa0addfa (patch) | |
tree | 626cee3ec5e144c0d764a0147374caebbcd910e0 /intern/cycles/util/util_vector.h | |
parent | aad96506c1baba091ad62dc50004303da9298208 (diff) |
Cycles: Add utility method to vector which totally frees memory used the vector
The method is called vector::free_memory(). Use with care since it'll invalidate
all the pointers to vector memory, all iterators and so on.
Currently unused, but might become handy when clearing unused data.
Diffstat (limited to 'intern/cycles/util/util_vector.h')
-rw-r--r-- | intern/cycles/util/util_vector.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/intern/cycles/util/util_vector.h b/intern/cycles/util/util_vector.h index 8d1bd7407ec..cf8fd22fe0e 100644 --- a/intern/cycles/util/util_vector.h +++ b/intern/cycles/util/util_vector.h @@ -76,6 +76,11 @@ public: } #endif + void free_memory(void) { + std::vector<value_type, allocator_type>::resize(0); + shrink_to_fit(); + } + /* Some external API might demand working with std::vector. */ operator std::vector<value_type>() { |