| Commit message (Collapse) | Author | Age |
|
|
|
|
| |
This function never actually did us any good, and it added a little
complexity. See the changes file for more info.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C99 allows a syntax for structures whose last element is of
unspecified length:
struct s {
int elt1;
...
char last_element[];
};
Recent (last-5-years) autoconf versions provide an
AC_C_FLEXIBLE_ARRAY_MEMBER test that defines FLEXIBLE_ARRAY_MEMBER
to either no tokens (if you have c99 flexible array support) or to 1
(if you don't). At that point you just use offsetof
[STRUCT_OFFSET() for us] to see where last_element begins, and
allocate your structures like:
struct s {
int elt1;
...
char last_element[FLEXIBLE_ARRAY_MEMBER];
};
tor_malloc(STRUCT_OFFSET(struct s, last_element) +
n_elements*sizeof(char));
The advantages are:
1) It's easier to see which structures and elements are of
unspecified length.
2) The compiler and related checking tools can also see which
structures and elements are of unspecified length, in case they
wants to try weird bounds-checking tricks or something.
3) The compiler can warn us if we do something dumb, like try
to stack-allocate a flexible-length structure.
|
|\
| |
| |
| |
| |
| | |
Conflicts:
src/common/test.h
src/or/test.c
|
| | |
|
|\|
| |
| |
| |
| |
| |
| | |
Conflicts:
src/common/memarea.c
src/or/or.h
src/or/rendclient.c
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
It's all too easy in C to convert an unsigned value to a signed one,
which will (on all modern computers) give you a huge signed value. If
you have a size_t value of size greater than SSIZE_T_MAX, that is way
likelier to be an underflow than it is to be an actual request for
more than 2gb of memory in one go. (There's nothing in Tor that
should be trying to allocate >2gb chunks.)
|
|/
|
|
|
|
|
|
|
|
| |
This should make us conflict less with system files named "log.h".
Yes, we shouldn't have been conflicting with those anyway, but some
people's compilers act very oddly.
The actual change was done with one "git mv", by editing
Makefile.am, and running
find . -name '*.[ch]' | xargs perl -i -pe 'if (/^#include.*\Wlog.h/) {s/log.h/torlog.h/; }'
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
The subversion $Id$ fields made every commit force a rebuild of
whatever file got committed. They were not actually useful for
telling the version of Tor files in the wild.
svn:r17867
|
|
|
|
|
|
| |
we ever did.
svn:r17827
|
|
|
|
|
|
|
| |
Fix bug 794: recover 3 bytes wasted per memory chunk. Fix from rovv.
svn:r16447
|
|
|
|
|
|
|
| |
Fix all remaining shorten-64-to-32 errors in src/common. Some were genuine problems. Many were compatibility errors with libraries (openssl, zlib) that like predate size_t. Partial backport candidate.
svn:r13665
|
|
|
|
|
|
|
| |
Re-tune mempool parametes based on testing on peacetime: use smaller chuncks, free them a little more aggressively, and try very hard to concentrate allocations on fuller chunks. Also, lots of new documentation.
svn:r13484
|
|
|
|
|
|
|
| |
"0 bytes in 1 empty chunks" is hardly likely.
svn:r13463
|
|
|
|
| |
svn:r13440
|
|
|
|
|
|
|
| |
Add a couple of (currently disabled) strategies for trying to avoid using too much ram in memory pools: prefer putting new cells in almost-full chunks, and be willing to free the last empty chunk if we have not needed it for a while. Also add better output to mp_pool_log_status to track how many mallocs a given memory pool strategy is saving us, so we can tune the mempool parameters.
svn:r13428
|
|
|
|
| |
svn:r13412
|
|
|
|
|
|
|
| |
Add more documentation; change the behavior of read_to_buf_tls to be more consistent. Note a longstanding problem with current read/write interfaces.
svn:r13407
|
|
|
|
|
|
|
| |
Remove some dead code; fix some XXX020s; turn some XXX020s into XXXX_IP6s (i.e., "needs to be fixed when we add ipv6 support").
svn:r13382
|
|
|
|
|
|
|
| |
New, slightly esoteric function, tor_malloc_roundup(). While tor_malloc(x) allocates x bytes, tor_malloc_roundup(&x) allocates the same size of chunk it would use to store x bytes, and sets x to the usable size of that chunk.
svn:r12981
|
|
|
|
| |
svn:r12786
|
|
|
|
|
|
|
| |
Build with fewer compiler warnings on Sun. (This and previous Sun patches are thanks to the tremendously handy services of unix-center.net.)
svn:r10644
|
|
|
|
|
|
|
| |
Try to fix some mipspro compiler warnings. There will still be some left.
svn:r10444
|
|
|
|
|
|
|
| |
Cleanup whitespace.
svn:r10425
|
|
|
|
|
|
|
| |
Resolve all but 3 DOCDOCs.
svn:r10393
|
|
|
|
| |
svn:r10335
|
|
|
|
|
|
|
| |
Add math functions to round values to the nearest power of 2. Make mempools more careful about making sure that the size of their chunks is a little less than a power of 2, not a little more.
svn:r10304
|
|
|
|
|
|
|
| |
Address points in r10227.
svn:r10229
|
|
|
|
|
|
|
| |
items we should probably look into.
svn:r10227
|
|
|
|
|
|
|
| |
Keep a freelist of unused 4k buffer chunks, rather than wasting 8k for every inactive connection_t.
svn:r10006
|
|
|
|
|
|
|
| |
Fix a bug in displaying memory pool usage. Also dump cell allocation, and track padded_cell_ts as they are allocated and freed, to make sure we are not leaking cells.
svn:r9992
|
|
|
|
|
|
|
| |
Make dumpmemusage() dump cell pool usage information.
svn:r9991
|
|
|
|
|
|
|
| |
More proposal-104 stuff: actually remember extra-info stuff.
svn:r9975
|
|
|
|
|
|
|
| |
Apparently some compilers think that anonymous unions are bad C. Technically, they're right, so let's name the union in mempool.c.
svn:r9946
|
|
|
|
|
|
|
| |
Add code to shrink the cell memory pool by discarding empty chunks that have been empty for the last 60 seconds. Also, instead of having test.c duplicate declarations for exposed functions, put them inside #ifdef foo_PRIVATE blocks in the headers. This prevents bugs where test.c gets out of sync.
svn:r9944
|
|
|
|
|
|
|
| |
Fix documentation and usage of 2nd argument to mp_pool_new.
svn:r9942
|
|
|
|
|
|
|
| |
Document memory pool implementation, and tweak it even mor. See? Programming is fun.
svn:r9940
|
|
|
|
|
|
|
| |
Add support for using memory pools to allocate queued cell; pass --disable-cell-pool to configure to disable this.
svn:r9939
|
|
|
|
|
|
|
| |
Unit tests and debugging for memory pool implementation.
svn:r9938
|
|
Initial version of memory pool logic. Needs unit tests. Made to be easily separable from Tor.
svn:r9937
|