Mercurial > hg > xemacs-beta
changeset 1550:6e7ace1ab32d
[xemacs-hg @ 2003-06-30 09:38:38 by stephent]
for big string leak <874r3nryum.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Mon, 30 Jun 2003 09:38:40 +0000 |
parents | bc9eadea35cf |
children | ddcdeb1a25c4 |
files | src/ChangeLog src/alloc.c |
diffstat | 2 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog Mon Jun 30 09:31:01 2003 +0000 +++ b/src/ChangeLog Mon Jun 30 09:38:40 2003 +0000 @@ -1,3 +1,12 @@ +2003-05-22 Stephen J. Turnbull <stephen@xemacs.org> + + * alloc.c (allocate_big_string_chars): New. + (make_uninit_string): Use it. + (resize_string): Use it. Bump cons counter on realloc, too. + + Based on analysis and patch by Martin Buchholz <martin@xemacs.org>: + <15409.4809.288773.686482@gargle.gargle.HOWL>. + 2003-06-01 Steve Youngs <youngs@xemacs.org> * XEmacs 21.5.14 "cassava" is released.
--- a/src/alloc.c Mon Jun 30 09:31:01 2003 +0000 +++ b/src/alloc.c Mon Jun 30 09:38:40 2003 +0000 @@ -2090,6 +2090,14 @@ current_string_chars_block = first_string_chars_block; } +static Ibyte * +allocate_big_string_chars (Bytecount length) +{ + Ibyte *p = xnew_array (Ibyte, length); + INCREMENT_CONS_COUNTER (length, "string chars"); + return p; +} + static struct string_chars * allocate_string_chars_struct (Lisp_Object string_it_goes_with, Bytecount fullsize) @@ -2164,7 +2172,7 @@ set_lheader_implementation (&s->u.lheader, &lrecord_string); set_lispstringp_data (s, BIG_STRING_FULLSIZE_P (fullsize) - ? xnew_array (Ibyte, length + 1) + ? allocate_big_string_chars (length + 1) : allocate_string_chars_struct (wrap_string (s), fullsize)->chars); @@ -2240,6 +2248,9 @@ if (delta > 0 && pos >= 0) memmove (XSTRING_DATA (s) + pos + delta, XSTRING_DATA (s) + pos, len); + /* Bump the cons counter. + Conservative; Martin let the increment be delta. */ + INCREMENT_CONS_COUNTER (newfullsize, "string chars"); } else /* String has been demoted from BIG_STRING. */ { @@ -2280,7 +2291,7 @@ Ibyte *old_data = XSTRING_DATA (s); Ibyte *new_data = BIG_STRING_FULLSIZE_P (newfullsize) - ? xnew_array (Ibyte, XSTRING_LENGTH (s) + delta + 1) + ? allocate_big_string_chars (XSTRING_LENGTH (s) + delta + 1) : allocate_string_chars_struct (s, newfullsize)->chars; if (pos >= 0)