File: mem-leak.py

package info (click to toggle)
pycxx 6.2.4-3
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,156 kB
  • sloc: cpp: 6,093; python: 756; sh: 47; ansic: 43; makefile: 38
file content (28 lines) | stat: -rw-r--r-- 625 bytes parent folder | download | duplicates (13)
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
import simple
import time
import sys
import os

def report( title ):
    print( title )
    os.system( 'ps uww -p %d' % (os.getpid(),) )

report( 'Start:' )

if sys.argv[1] == 'encode':
    for x in range( 1000000 ):
        y = '%6d-Hello-%6d' % (x, x)
else:
    for x in range( 1000000 ):
        y = ('%6d-Hello-%6d' % (x, x)).encode( 'utf-8' )

report( 'InitDone:' )

if sys.argv[1] == 'encode':
    for x in range( 1000000 ):
        y = simple.encode_test( '%6d-Hello-%6d' % (x, x) )
else:
    for x in range( 1000000 ):
        y = simple.decode_test( ('%6d-Hello-%6d' % (x, x)).encode( 'utf-8' ) )

report( 'Done:' )