Daniel Veillard | c6d4a93 | 2002-09-12 15:00:57 +0000 | [diff] [blame] | 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 |