a7cc7a6176564d1d48b5ad4031db5cda3f7ffa0e
[platform/upstream/libxml2.git] / python / tests / inbuf.py
1 #!/usr/bin/python -u
2 import sys
3 import libxml2
4 import StringIO
5
6 # Memory debug specific
7 libxml2.debugMemory(1)
8
9 i = 0
10 while i < 5000:
11     f = StringIO.StringIO("foobar")
12     buf = libxml2.inputBuffer(f)
13     i = i + 1
14
15 del f
16 del buf
17
18 # Memory debug specific
19 libxml2.cleanupParser()
20 if libxml2.debugMemory(1) == 0:
21     print "OK"
22 else:
23     print "Memory leak %d bytes" % (libxml2.debugMemory(1))
24     libxml2.dumpMemory()
25