From: Nick Mathewson Date: Mon, 30 Jul 2007 17:47:43 +0000 (+0000) Subject: Yet another buffer RAM patch: tNever ever ever keep a buffer memory chunk around... X-Git-Tag: tor-0.2.0.4-alpha@11197~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9260a824ef1218cfbb9c4dfae3b2c5c241251fc7;p=thirdparty%2Ftor.git Yet another buffer RAM patch: tNever ever ever keep a buffer memory chunk around for an empty buffer that could go on the freelist. This wants profiling to make sure that performance doesnt suffer. svn:r10993 --- diff --git a/ChangeLog b/ChangeLog index a9f6da2d8a..f4ff34fb40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Changes in version 0.2.0.4-alpha - 2007-??-?? + o Minor features (performance): + - Be even more aggressive about releasing RAM from small + empty buffers. Thanks to our free-list code, this shouldn't be too + performance-intensive. + + Changes in version 0.2.0.3-alpha - 2007-07-29 o Major features: - The first pieces of our "bridge" design for blocking-resistance diff --git a/src/or/buffers.c b/src/or/buffers.c index c5d8b1c7d0..30f98bd580 100644 --- a/src/or/buffers.c +++ b/src/or/buffers.c @@ -486,7 +486,13 @@ buf_remove_from_front(buf_t *buf, size_t n) if (buf->datalen) { buf->cur = _wrap_ptr(buf, buf->cur+n); } else { - buf->cur = buf->mem; + if (IS_FREELIST_SIZE(buf->len)) { + buf->highwater = 0; + if (add_buf_mem_to_freelist(buf)) + return; + } else { + buf->cur = buf->mem; + } } check(); }