File: memdump_maxalloc.py

package info (click to toggle)
python-pyahocorasick 1.4.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 748 kB
  • sloc: ansic: 4,554; python: 2,823; sh: 312; makefile: 242
file content (32 lines) | stat: -rw-r--r-- 549 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys

def main():
    try:
        path = sys.argv[1]
    except IndexError:
        path = 'memory.dump'

    app = Application(path)
    app.run()


class Application(object):
    def __init__(self, path):
        self.path = path


    def run(self):
        with open(self.path, 'rt') as f:
            print(max(self.ids(f)))


    def ids(self, file):
        for i, line in enumerate(file):
            fields = line.split()
            if fields[0] == 'A':
                yield int(fields[1])


if __name__ == '__main__':
    main()