This is the external method used to print current zope memory usage on WikiStats. See also MemoryUsage.

def memusage(self):
 """
 Get this process's memory usage.
 """
 # method 1
 # doesn't work on some shared hosts
 import resource
 usage = resource.getrusage(resource.RUSAGE_SELF)[2]
 if usage > 0: return usage

 # method 2
 # requires a suitable ps command
 # may fail in low-memory situations
 import os
 try: return int(os.popen('ps h -o vsize %s'%os.getpid()).read())
 except: return 0