def getRam(matrix, filename):
    purge('.')
    subprocess.run(['valgrind', '--tool=massif', '--stacks=yes', '--pages-as-heap=no', filename, matrix])
    ps = subprocess.Popen('ls', stdout=subprocess.PIPE)
    resultFilename = subprocess.check_output(('grep', 'massif.out'), stdin=ps.stdout).decode(sys.stdout.encoding).strip()
    ps.wait()
    maxUsage = get_mem_usage(resultFilename)
    return maxUsage
def getRam(matrix, filename):
    purge('.')
    subprocess.run(['valgrind', '--tool=massif', '--stacks=yes', '--pages-as-heap=no', filename, matrix])
    ps = subprocess.Popen('ls', stdout=subprocess.PIPE)
    resultFilename = subprocess.check_output(('grep', 'massif.out'), stdin=ps.stdout).decode(sys.stdout.encoding).strip()
    ps.wait()
    maxUsage = get_mem_usage(resultFilename)
    return maxUsage