summaryrefslogtreecommitdiff
path: root/gcc/vec.h
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2013-07-11 21:32:14 +0000
committerTeresa Johnson <tejohnson@gcc.gnu.org>2013-07-11 21:32:14 +0000
commit7b24b675378a69ff254e4a4b5faa3615d4abd84d (patch)
treed76fb8801d882b05bf1c9285d1a89d33bf3b002e /gcc/vec.h
parent85d4cbb878c645fbb76838f228ac24cd4c898212 (diff)
This patch adds a call to ggc_free from va_gc::release, which is called by vec_free.
This patch adds a call to ggc_free from va_gc::release, which is called by vec_free. This restores the functionality of the old VEC_free and reduces the memory footprint during compilation. 2013-07-11 Teresa Johnson <tejohnson@google.com> * vec.h (struct va_gc): Move release out-of-line. (va_gc::release): Call ggc_free on released vec. From-SVN: r200909
Diffstat (limited to 'gcc/vec.h')
-rw-r--r--gcc/vec.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/vec.h b/gcc/vec.h
index 3c1bb9a3d6b..09a1d0a4d86 100644
--- a/gcc/vec.h
+++ b/gcc/vec.h
@@ -337,10 +337,22 @@ struct va_gc
CXX_MEM_STAT_INFO);
template<typename T, typename A>
- static void release (vec<T, A, vl_embed> *&v) { v = NULL; }
+ static void release (vec<T, A, vl_embed> *&v);
};
+/* Free GC memory used by V and reset V to NULL. */
+
+template<typename T, typename A>
+inline void
+va_gc::release (vec<T, A, vl_embed> *&v)
+{
+ if (v)
+ ::ggc_free (v);
+ v = NULL;
+}
+
+
/* Allocator for GC memory. Ensure there are at least RESERVE free
slots in V. If EXACT is true, grow exactly, else grow
exponentially. As a special case, if the vector had not been