aboutsummaryrefslogtreecommitdiff
path: root/src/or/buffers.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-07-30 17:47:43 +0000
committerNick Mathewson <nickm@torproject.org>2007-07-30 17:47:43 +0000
commit9260a824ef1218cfbb9c4dfae3b2c5c241251fc7 (patch)
tree95e76c9b93550f816eed35a62ded0d60f4ca2c35 /src/or/buffers.c
parent34a3a5e2f4a1eb0c3256cccd22e1efae8584e946 (diff)
downloadtor-9260a824ef1218cfbb9c4dfae3b2c5c241251fc7.tar.gz
tor-9260a824ef1218cfbb9c4dfae3b2c5c241251fc7.zip
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
Diffstat (limited to 'src/or/buffers.c')
-rw-r--r--src/or/buffers.c8
1 files changed, 7 insertions, 1 deletions
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();
}