def getMemorySize():
 try:
  statm = open('/proc/self/statm').readline().split()
 except IOError:
  return None
 return (int(statm[0]) * PAGE_SIZE)

def getMemorySize ( ) : try : statm = open ( '/proc/self/statm' ) . readline ( ) . split ( ) except IOError : return None return ( int ( statm [ 0 ] ) * PAGE_SIZE )
read currenet process memory size: size of available virtual memory .