[pypy-svn] r78120 - in pypy/trunk/pypy: rlib rpython

antocuni at codespeak.net antocuni at codespeak.net
Wed Oct 20 13:04:03 CEST 2010


Author: antocuni
Date: Wed Oct 20 13:04:02 2010
New Revision: 78120

Modified:
   pypy/trunk/pypy/rlib/clibffi.py
   pypy/trunk/pypy/rpython/llinterp.py
Log:
(antocuni, arigo): don't track these mallocs, they are automatically freed in the __del__


Modified: pypy/trunk/pypy/rlib/clibffi.py
==============================================================================
--- pypy/trunk/pypy/rlib/clibffi.py	(original)
+++ pypy/trunk/pypy/rlib/clibffi.py	Wed Oct 20 13:04:02 2010
@@ -385,10 +385,12 @@
         self.restype = restype
         self.flags = flags
         argnum = len(argtypes)
-        self.ll_argtypes = lltype.malloc(FFI_TYPE_PP.TO, argnum, flavor='raw')
+        self.ll_argtypes = lltype.malloc(FFI_TYPE_PP.TO, argnum, flavor='raw',
+                                         track_allocation=False) # freed by the __del__
         for i in range(argnum):
             self.ll_argtypes[i] = argtypes[i]
-        self.ll_cif = lltype.malloc(FFI_CIFP.TO, flavor='raw')
+        self.ll_cif = lltype.malloc(FFI_CIFP.TO, flavor='raw',
+                                    track_allocation=False) # freed by the __del__
 
         if _WIN32 and (flags & FUNCFLAG_CDECL == 0):
             cc = FFI_STDCALL

Modified: pypy/trunk/pypy/rpython/llinterp.py
==============================================================================
--- pypy/trunk/pypy/rpython/llinterp.py	(original)
+++ pypy/trunk/pypy/rpython/llinterp.py	Wed Oct 20 13:04:02 2010
@@ -717,9 +717,11 @@
     def op_malloc_varsize(self, obj, flags, size):
         flavor = flags['flavor']
         zero = flags.get('zero', False)
+        track_allocation = flags.get('track_allocation', True)
         assert flavor in ('gc', 'raw')
         try:
-            ptr = self.heap.malloc(obj, size, zero=zero, flavor=flavor)
+            ptr = self.heap.malloc(obj, size, zero=zero, flavor=flavor,
+                                   track_allocation=track_allocation)
             return ptr
         except MemoryError:
             self.make_llexception()



More information about the Pypy-commit mailing list