Author: Greg Price <[email protected]>
Branch: 
Changeset: r62541:3a60f1ff6d07
Date: 2013-03-19 19:47 -0700
http://bitbucket.org/pypy/pypy/changeset/3a60f1ff6d07/

Log:    ll2ctypes: Get unmap from ctypes before it's too late

diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py 
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -105,6 +105,12 @@
         else:
             assert False  # should always generate flags
 
+        # Map and unmap something just to exercise unmap so that we (lazily)
+        # build the ctypes callable.  Otherwise, when we reach unmap below
+        # we may already have a giant map and be unable to fork, as for the
+        # /sbin/ldconfig call inside ctypes.util.find_library().
+        rmmap.mmap(-1, 4096, *flags).close()
+
         m = rmmap.mmap(-1, PIECES * PIECE_STRIDE, *flags)
         m.close = lambda : None    # leak instead of giving a spurious
                                    # error at CPython's shutdown
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to