On Tue, Mar 24, 2015 at 10:54:25PM +0100, Martin Liška wrote:
> --- a/gcc/symbol-summary.h
> +++ b/gcc/symbol-summary.h
> @@ -81,6 +81,12 @@ public:
>      m_symtab_insertion_hook = NULL;
>      m_symtab_removal_hook = NULL;
>      m_symtab_duplication_hook = NULL;
> +
> +    /* Release all summaries in case we use non-GGC memory.  */
> +    typedef typename hash_map <int, T *, summary_hashmap_traits>::iterator 
> map_iterator;
> +    if (!m_ggc)
> +      for (map_iterator it = m_map.begin (); it != m_map.end (); ++it)
> +     release ((*it).second);

You haven't removed the now unnecessary if (!m_ggc) guard.

> @@ -106,6 +112,15 @@ public:
>      return m_ggc ? new (ggc_alloc <T> ()) T() : new T () ;
>    }
>  
> +  /* Release an item that is stored within map.  */
> +  void release (T *item)
> +  {
> +    if (m_ggc)
> +      ggc_free (item);

Perhaps run also the item's destructor first?  I know that
inline_summary doesn't have a user destructor, so it will expand to nothing,
so it would be just for completeness.

> +    else
> +      delete item;
> +  }
> +

        Jakub

Reply via email to