def METHOD_NAME():
  while(not completed):
    stats = subprocess.check_output(["free"])
    stats_list = stats.split()
    total_mem = float(stats_list[7])
    used_mem = float(stats_list[8])
    memory_usage = used_mem / total_mem
    if(memory_usage > 0.8):
      ret = os.system("cat " + mem_path + "kmap >> " + directory + "test.kmap")
      if ret != 0:
        print "Failed to append kmap to temp file"
        exit(1)
      ret = os.system("echo 1 > " + mem_path + "clear_printed_list")
      if ret != 0:
        print "Failed to clear printed list"
        exit(1)
    time.sleep(2)