Last change
on this file since 11632 was 6076, checked in by vboxsync, 17 years ago |
Merged dmik/s2 branch (r25959:26751) to the trunk.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Date Revision Author Id
|
File size:
777 bytes
|
Line | |
---|
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 | def myResolver(URL, ID, ctxt):
|
---|
10 | return(StringIO.StringIO("<foo/>"))
|
---|
11 |
|
---|
12 | libxml2.setEntityLoader(myResolver)
|
---|
13 |
|
---|
14 | doc = libxml2.parseFile("doesnotexist.xml")
|
---|
15 | root = doc.children
|
---|
16 | if root.name != "foo":
|
---|
17 | print "root element name error"
|
---|
18 | sys.exit(1)
|
---|
19 | doc.freeDoc()
|
---|
20 |
|
---|
21 | i = 0
|
---|
22 | while i < 5000:
|
---|
23 | doc = libxml2.parseFile("doesnotexist.xml")
|
---|
24 | root = doc.children
|
---|
25 | if root.name != "foo":
|
---|
26 | print "root element name error"
|
---|
27 | sys.exit(1)
|
---|
28 | doc.freeDoc()
|
---|
29 | i = i + 1
|
---|
30 |
|
---|
31 |
|
---|
32 | # Memory debug specific
|
---|
33 | libxml2.cleanupParser()
|
---|
34 | if libxml2.debugMemory(1) == 0:
|
---|
35 | print "OK"
|
---|
36 | else:
|
---|
37 | print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
---|
38 | libxml2.dumpMemory()
|
---|
39 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.