[tor-dev] Memory usage of Tor daemon

Rob van der Hoeven robvanderhoeven at ziggo.nl
Fri May 20 10:03:35 UTC 2016


Hi,

I'm running Tor on a router and was wondering why the Tor daemon uses so
much memory. Did a pmap:

pmap `pidof tor`

And got the following result:

1703:   /usr/sbin/tor --PidFile /var/run/tor.pid
00400000   1024K r-x--  /usr/sbin/tor
0050f000      4K r----  /usr/sbin/tor
00510000     20K rw---  /usr/sbin/tor
00515000     12K rwx--    [ anon ]
00ae9000     36K rwx--    [ anon ]
00af2000  17288K rwx--    [ anon ]
7713a000   7140K r----  /tmp/lib/tor/cached-microdescs
77833000    516K rw---    [ anon ]
778f5000    348K r-x--  /lib/libuClibc-0.9.33.2.so
7794c000     60K -----    [ anon ]
7795b000      4K r----  /lib/libuClibc-0.9.33.2.so
7795c000      4K rw---  /lib/libuClibc-0.9.33.2.so
7795d000     20K rw---    [ anon ]
77962000     80K r-x--  /lib/libgcc_s.so.1
77976000     60K -----    [ anon ]
77985000      4K rw---  /lib/libgcc_s.so.1
77986000     12K r-x--  /lib/libdl-0.9.33.2.so
77989000     60K -----    [ anon ]
77998000      4K r----  /lib/libdl-0.9.33.2.so
77999000      4K rw---  /lib/libdl-0.9.33.2.so
7799a000     76K r-x--  /lib/libpthread-0.9.33.2.so
779ad000     60K -----    [ anon ]
779bc000      4K r----  /lib/libpthread-0.9.33.2.so
779bd000      4K rw---  /lib/libpthread-0.9.33.2.so
779be000      8K rw---    [ anon ]
779c0000   1300K r-x--  /usr/lib/libcrypto.so.1.0.0
77b05000     64K -----    [ anon ]
77b15000     72K rw---  /usr/lib/libcrypto.so.1.0.0
77b27000      4K rw---    [ anon ]
77b28000    292K r-x--  /usr/lib/libssl.so.1.0.0
77b71000     60K -----    [ anon ]
77b80000     20K rw---  /usr/lib/libssl.so.1.0.0
77b85000    176K r-x--  /usr/lib/libevent-2.0.so.5.1.9
77bb1000     64K -----    [ anon ]
77bc1000      4K rw---  /usr/lib/libevent-2.0.so.5.1.9
77bc2000     88K r-x--  /lib/libm-0.9.33.2.so
77bd8000     60K -----    [ anon ]
77be7000      4K rw---  /lib/libm-0.9.33.2.so
77be8000     56K r-x--  /usr/lib/libz.so.1.2.8
77bf6000     60K -----    [ anon ]
77c05000      4K rw---  /usr/lib/libz.so.1.2.8
77c06000     28K r-x--  /lib/ld-uClibc-0.9.33.2.so
77c1a000      8K rw---    [ anon ]
77c1c000      4K r----  /lib/ld-uClibc-0.9.33.2.so
77c1d000      4K rw---  /lib/ld-uClibc-0.9.33.2.so
7f9a0000    132K rw---    [ stack ]
7fff7000      4K r-x--    [ anon ]
 total    29360K

As you can see there is a large 17288K block which turns out to be a
heap (of course). When I dumped the block and looked inside I found it
was full of router data. Looks like it is mostly an in-memory database
of the router list. 

This worries me. If in the future the router list grows, my router (and
many other routers running Tor) can run out of memory. For me, it looks
a little bit strange to have an in-memory database of the router list.
Is there a reason for having this data in memory? And, can something be
done about it?

Rob.
https://hoevenstein.nl




More information about the tor-dev mailing list