Rev 105: Document the new functionality in http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

John Arbash Meinel john at arbash-meinel.com
Thu Oct 22 23:05:11 BST 2009


At http://bazaar.launchpad.net/~meliae-dev/meliae/trunk

------------------------------------------------------------
revno: 105
revision-id: john at arbash-meinel.com-20091022220500-mqq2feeapg0l3zbm
parent: john at arbash-meinel.com-20091022220241-x902omy964q6pk22
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: trunk
timestamp: Thu 2009-10-22 17:05:00 -0500
message:
  Document the new functionality
-------------- next part --------------
=== modified file 'meliae/loader.py'
--- a/meliae/loader.py	2009-10-22 22:02:41 +0000
+++ b/meliae/loader.py	2009-10-22 22:05:00 +0000
@@ -213,6 +213,16 @@
             for ref in obj.ref_list:
                 ref = unique_address(ref, ref)
                 refs = referrers.get(ref, None)
+                # This is ugly, so it should be explained.
+                # To save memory pressure, referrers will point to one of 3
+                # types.
+                #   1) A simple integer, representing a single referrer
+                #      this saves the allocation of a separate structure
+                #      entirely
+                #   2) A tuple, slightly more efficient than a list, but
+                #      requires creating a new tuple to 'add' an entry.
+                #   3) A list, as before, for things with lots of referrers, we
+                #      use a regular list to let it grow.
                 t = type(refs)
                 if refs is None:
                     refs = address

=== modified file 'meliae/tests/test_loader.py'
--- a/meliae/tests/test_loader.py	2009-10-22 21:47:42 +0000
+++ b/meliae/tests/test_loader.py	2009-10-22 22:05:00 +0000
@@ -101,7 +101,7 @@
         self.assertTrue(isinstance(obj, _loader.MemObject))
         # The address should be exactly the same python object as the key in
         # the objs dictionary.
-        self.assertIs(keys[0], obj.address)
+        self.assertTrue(keys[0] is obj.address)
 
     def test_load_example(self):
         objs = loader.load(_example_dump, show_prog=False)



More information about the bazaar-commits mailing list