Annotation of embedaddon/libxml2/python/tests/inbuf.py, revision 1.1.1.2
1.1 misho 1: #!/usr/bin/python -u
2: import sys
3: import libxml2
1.1.1.2 ! misho 4: try:
! 5: import StringIO
! 6: str_io = StringIO.StringIO
! 7: except:
! 8: import io
! 9: str_io = io.StringIO
1.1 misho 10:
11: # Memory debug specific
12: libxml2.debugMemory(1)
13:
14: i = 0
15: while i < 5000:
1.1.1.2 ! misho 16: f = str_io("foobar")
1.1 misho 17: buf = libxml2.inputBuffer(f)
18: i = i + 1
19:
20: del f
21: del buf
22:
23: # Memory debug specific
24: libxml2.cleanupParser()
25: if libxml2.debugMemory(1) == 0:
1.1.1.2 ! misho 26: print("OK")
1.1 misho 27: else:
1.1.1.2 ! misho 28: print("Memory leak %d bytes" % (libxml2.debugMemory(1)))
1.1 misho 29: libxml2.dumpMemory()
30:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>