code: def update(self):
          
          try:
              stat = open('/proc/self/stat')
              status = open('/proc/self/status')
          except IOError: # pragma: no cover
              return False
          else:
              stats = stat.read().split()
              self.vsz = int( stats[22] )
              self.rss = int( stats[23] ) * self.pagesize
              self.pagefaults = int( stats[11] )
  
              for entry in status.readlines():
                  key, value = entry.split(':')
                  size_in_bytes = lambda x: int(x.split()[0]) * 1024
                  if key == 'VmData':
                      self.data_segment = size_in_bytes(value)
                  elif key == 'VmExe':
                      self.code_segment = size_in_bytes(value)
                  elif key == 'VmLib':
                      self.shared_segment = size_in_bytes(value)
                  elif key == 'VmStk':
                      self.stack_segment = size_in_bytes(value)
                  key = self.key_map.get(key)
                  if key:
                      self.os_specific.append((key, value.strip()))
  
  
              stat.close()
              status.close()
              return True
docs: Get virtual size of current process by reading the process' stat file.
          This should work for Linux.