[pypy-svn] r76889 - pypy/branch/gc-module/pypy/module/gc

arigo at codespeak.net arigo at codespeak.net
Mon Sep 6 11:01:29 CEST 2010


Author: arigo
Date: Mon Sep  6 11:01:27 2010
New Revision: 76889

Modified:
   pypy/branch/gc-module/pypy/module/gc/__init__.py
   pypy/branch/gc-module/pypy/module/gc/interp_gc.py
Log:
Kill gc.estimate_heap_size().  It's not too useful in that form.


Modified: pypy/branch/gc-module/pypy/module/gc/__init__.py
==============================================================================
--- pypy/branch/gc-module/pypy/module/gc/__init__.py	(original)
+++ pypy/branch/gc-module/pypy/module/gc/__init__.py	Mon Sep  6 11:01:27 2010
@@ -10,7 +10,6 @@
         'collect': 'interp_gc.collect',
         'enable_finalizers': 'interp_gc.enable_finalizers',
         'disable_finalizers': 'interp_gc.disable_finalizers',
-        'estimate_heap_size': 'interp_gc.estimate_heap_size',
         'garbage' : 'space.newlist([])',
         #'dump_heap_stats': 'interp_gc.dump_heap_stats',
     }

Modified: pypy/branch/gc-module/pypy/module/gc/interp_gc.py
==============================================================================
--- pypy/branch/gc-module/pypy/module/gc/interp_gc.py	(original)
+++ pypy/branch/gc-module/pypy/module/gc/interp_gc.py	Mon Sep  6 11:01:27 2010
@@ -24,36 +24,6 @@
 
 # ____________________________________________________________
 
-import sys
-platform = sys.platform
-
-def estimate_heap_size(space):
-    # XXX should be done with the help of the GCs
-    if platform == "linux2":
-        import os
-        pid = os.getpid()
-        try:
-            fd = os.open("/proc/" + str(pid) + "/status", os.O_RDONLY, 0777)
-        except OSError:
-            pass
-        else:
-            try:
-                content = os.read(fd, 1000000)
-            finally:
-                os.close(fd)
-            lines = content.split("\n")
-            for line in lines:
-                if line.startswith("VmSize:"):
-                    start = line.find(" ") # try to ignore tabs
-                    assert start > 0
-                    stop = len(line) - 3
-                    assert stop > 0
-                    result = int(line[start:stop].strip(" ")) * 1024
-                    return space.wrap(result)
-    raise OperationError(space.w_RuntimeError,
-                         space.wrap("can't estimate the heap size"))
-estimate_heap_size.unwrap_spec = [ObjSpace]
-
 def dump_heap_stats(space, filename):
     tb = rgc._heap_stats()
     if not tb:



More information about the Pypy-commit mailing list