From a7ef07b4bd3a4a3ba66336601e5a27649cb923d9 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 26 Dec 2007 00:12:08 +0000 Subject: r15693@tombo: nickm | 2007-12-25 19:11:29 -0500 Here, have some terribly clever new buffer code. It uses a mbuf-like strategy rather than a ring buffer strategy, so it should require far far less extra memory to hold any given amount of data. Also, it avoids access patterns like x=malloc(1024);x=realloc(x,1048576);x=realloc(x,1024);append_to_freelist(x) that might have been contributing to memory fragmentation. I've tested it out a little on peacetime, and it seems to work so far. If you want to benchmark it for speed, make sure to remove the #define PARANOIA; #define NOINLINE macros at the head of the module. svn:r12983 --- src/or/or.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/or/or.h') diff --git a/src/or/or.h b/src/or/or.h index d0aa9902bd..1979d7638f 100644 --- a/src/or/or.h +++ b/src/or/or.h @@ -2439,7 +2439,8 @@ void buf_shrink_freelists(int free_all); void buf_dump_freelist_sizes(int severity); size_t buf_datalen(const buf_t *buf); -size_t buf_capacity(const buf_t *buf); +size_t buf_allocation(const buf_t *buf); +size_t buf_slack(const buf_t *buf); const char *_buf_peek_raw_buffer(const buf_t *buf); int read_to_buf(int s, size_t at_most, buf_t *buf, int *reached_eof); -- cgit v1.2.3-54-g00ecf