Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. def memory_usage():
  2.     """Memory usage of the current process in kilobytes."""
  3.     status = None
  4.     result = 0;
  5.     try:
  6.         status = open('/proc/self/status');
  7.         for line in status:
  8.             parts = line.split();
  9.             if parts[0][:-1] == 'VmPeak':
  10.                 result = int(parts[1]);
  11.     finally:
  12.         if status is not None:
  13.             status.close();
  14.     return result;




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2018