[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [arm/master] fix: Lowering get_network_status call memory usage
commit 40580190efde4a645481da72571f2722c7aa8c8b
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Thu Jun 16 07:35:14 2011 -0700
fix: Lowering get_network_status call memory usage
When generating the IP -> fingerprint mappings I call the TorCtl
get_network_status function which generates a TorCtl.NetworkStatus instance for
every relay that exists. Since all of the memory is allocated at once this
increases the preceived memory footprint of arm by 3.5 MB. This is because even
after the memory's freed the python allocator doesn't actually give the memory
back:
http://effbot.org/pyfaq/why-doesnt-python-release-the-memory-when-i-delete-a-large-object.htm
This uses (and relies) on a change in TorCtl to use an iterator instead to
avoid this mass allocation:
https://gitweb.torproject.org/atagar/pytorctl.git/commit/45d7753b7c947b141210017d1b987673c51d97c5
In practice this lowers arm's baseline memory usage by 2.5 MB (12%).
---
src/util/torTools.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util/torTools.py b/src/util/torTools.py
index 8c18a9d..14f24a0 100644
--- a/src/util/torTools.py
+++ b/src/util/torTools.py
@@ -1637,7 +1637,7 @@ class Controller(TorCtl.PostEventListener):
if self.isAlive():
# fetch the current network status if not provided
if not nsList:
- try: nsList = self.conn.get_network_status()
+ try: nsList = self.conn.get_network_status(getIterator=True)
except (socket.error, TorCtl.TorCtlClosed, TorCtl.ErrorReply): nsList = []
# construct mappings of ips to relay data
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits