[pypy-commit] pypy raw-memory-pressure-nursery: hopefully clean up and improve

fijal noreply at buildbot.pypy.org
Wed Feb 15 00:04:13 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: raw-memory-pressure-nursery
Changeset: r52491:aad4ffbb7df8
Date: 2012-02-15 01:03 +0200
http://bitbucket.org/pypy/pypy/changeset/aad4ffbb7df8/

Log:	hopefully clean up and improve

diff --git a/pypy/module/thread/ll_thread.py b/pypy/module/thread/ll_thread.py
--- a/pypy/module/thread/ll_thread.py
+++ b/pypy/module/thread/ll_thread.py
@@ -83,9 +83,10 @@
                               _nowrapper=True)
 
 def allocate_lock():
-    lock = instantiate(Lock)
-    ll_lock = allocate_ll_lock(lock)
-    lock.__init__(lock, ll_lock)
+    lock = Lock(allocate_ll_lock())
+    # Add some memory pressure for the size of the lock because it is an
+    # Opaque object
+    rgc.add_memory_pressure(lock, TLOCKP_SIZE)
     return lock
 
 @specialize.arg(0)
@@ -170,9 +171,6 @@
     if rffi.cast(lltype.Signed, res) <= 0:
         lltype.free(ll_lock, flavor='raw', track_allocation=False)
         raise error("out of resources")
-    # Add some memory pressure for the size of the lock because it is an
-    # Opaque object
-    rgc.add_memory_pressure(TLOCKP_SIZE)
     return ll_lock
 
 def free_ll_lock(ll_lock):


More information about the pypy-commit mailing list