073263
To: vim_dev@googlegroups.com
073263
Subject: Patch 7.4.615
073263
Fcc: outbox
073263
From: Bram Moolenaar <Bram@moolenaar.net>
073263
Mime-Version: 1.0
073263
Content-Type: text/plain; charset=UTF-8
073263
Content-Transfer-Encoding: 8bit
073263
------------
073263
073263
Patch 7.4.615
073263
Problem:    Vim hangs when freeing a lot of objects.
073263
Solution:   Do not go back to the start of the list every time.  (Yasuhiro
073263
	    Matsumoto and Ariya Mizutani)
073263
Files:	    src/eval.c
073263
073263
073263
*** ../vim-7.4.614/src/eval.c	2015-02-03 12:55:11.136179596 +0100
073263
--- src/eval.c	2015-02-03 17:02:59.497727303 +0100
073263
***************
073263
*** 5974,5980 ****
073263
  }
073263
  
073263
  /*
073263
!  * Free a list, including all items it points to.
073263
   * Ignores the reference count.
073263
   */
073263
      void
073263
--- 5974,5980 ----
073263
  }
073263
  
073263
  /*
073263
!  * Free a list, including all non-container items it points to.
073263
   * Ignores the reference count.
073263
   */
073263
      void
073263
***************
073263
*** 6941,6954 ****
073263
  free_unref_items(copyID)
073263
      int copyID;
073263
  {
073263
!     dict_T	*dd;
073263
!     list_T	*ll;
073263
      int		did_free = FALSE;
073263
  
073263
      /*
073263
       * Go through the list of dicts and free items without the copyID.
073263
       */
073263
      for (dd = first_dict; dd != NULL; )
073263
  	if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK))
073263
  	{
073263
  	    /* Free the Dictionary and ordinary items it contains, but don't
073263
--- 6941,6956 ----
073263
  free_unref_items(copyID)
073263
      int copyID;
073263
  {
073263
!     dict_T	*dd, *dd_next;
073263
!     list_T	*ll, *ll_next;
073263
      int		did_free = FALSE;
073263
  
073263
      /*
073263
       * Go through the list of dicts and free items without the copyID.
073263
       */
073263
      for (dd = first_dict; dd != NULL; )
073263
+     {
073263
+ 	dd_next = dd->dv_used_next;
073263
  	if ((dd->dv_copyID & COPYID_MASK) != (copyID & COPYID_MASK))
073263
  	{
073263
  	    /* Free the Dictionary and ordinary items it contains, but don't
073263
***************
073263
*** 6956,6967 ****
073263
  	     * of dicts or list of lists. */
073263
  	    dict_free(dd, FALSE);
073263
  	    did_free = TRUE;
073263
- 
073263
- 	    /* restart, next dict may also have been freed */
073263
- 	    dd = first_dict;
073263
  	}
073263
! 	else
073263
! 	    dd = dd->dv_used_next;
073263
  
073263
      /*
073263
       * Go through the list of lists and free items without the copyID.
073263
--- 6958,6966 ----
073263
  	     * of dicts or list of lists. */
073263
  	    dict_free(dd, FALSE);
073263
  	    did_free = TRUE;
073263
  	}
073263
! 	dd = dd_next;
073263
!     }
073263
  
073263
      /*
073263
       * Go through the list of lists and free items without the copyID.
073263
***************
073263
*** 6969,6974 ****
073263
--- 6968,6975 ----
073263
       * are not referenced anywhere.
073263
       */
073263
      for (ll = first_list; ll != NULL; )
073263
+     {
073263
+ 	ll_next = ll->lv_used_next;
073263
  	if ((ll->lv_copyID & COPYID_MASK) != (copyID & COPYID_MASK)
073263
  						      && ll->lv_watch == NULL)
073263
  	{
073263
***************
073263
*** 6977,6989 ****
073263
  	     * or list of lists. */
073263
  	    list_free(ll, FALSE);
073263
  	    did_free = TRUE;
073263
- 
073263
- 	    /* restart, next list may also have been freed */
073263
- 	    ll = first_list;
073263
  	}
073263
! 	else
073263
! 	    ll = ll->lv_used_next;
073263
! 
073263
      return did_free;
073263
  }
073263
  
073263
--- 6978,6986 ----
073263
  	     * or list of lists. */
073263
  	    list_free(ll, FALSE);
073263
  	    did_free = TRUE;
073263
  	}
073263
! 	ll = ll_next;
073263
!     }
073263
      return did_free;
073263
  }
073263
  
073263
***************
073263
*** 7213,7219 ****
073263
  }
073263
  
073263
  /*
073263
!  * Free a Dictionary, including all items it contains.
073263
   * Ignores the reference count.
073263
   */
073263
      void
073263
--- 7210,7216 ----
073263
  }
073263
  
073263
  /*
073263
!  * Free a Dictionary, including all non-container items it contains.
073263
   * Ignores the reference count.
073263
   */
073263
      void
073263
*** ../vim-7.4.614/src/version.c	2015-02-03 16:53:47.155669292 +0100
073263
--- src/version.c	2015-02-03 16:56:07.790157478 +0100
073263
***************
073263
*** 743,744 ****
073263
--- 743,746 ----
073263
  {   /* Add new patch number below this line */
073263
+ /**/
073263
+     615,
073263
  /**/
073263
073263
-- 
073263
hundred-and-one symptoms of being an internet addict:
073263
170. You introduce your wife as "my_lady@home.wife" and refer to your
073263
     children as "forked processes."
073263
073263
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
073263
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
073263
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
073263
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///