VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.31/python/tests/push.py@ 55391

最後變更 在這個檔案從55391是 39915,由 vboxsync 提交於 13 年 前

libxml-2.6.31 unmodified

  • 屬性 svn:eol-style 設為 native
檔案大小: 765 位元組
 
1#!/usr/bin/python -u
2import sys
3import libxml2
4
5# Memory debug specific
6libxml2.debugMemory(1)
7
8ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
9ctxt.parseChunk("/>", 2, 1)
10doc = ctxt.doc()
11ctxt=None
12if doc.name != "test.xml":
13 print "document name error"
14 sys.exit(1)
15root = doc.children
16if root.name != "foo":
17 print "root element name error"
18 sys.exit(1)
19doc.freeDoc()
20i = 10000
21while i > 0:
22 ctxt = libxml2.createPushParser(None, "<foo", 4, "test.xml")
23 ctxt.parseChunk("/>", 2, 1)
24 doc = ctxt.doc()
25 doc.freeDoc()
26 i = i -1
27ctxt=None
28
29# Memory debug specific
30libxml2.cleanupParser()
31if libxml2.debugMemory(1) == 0:
32 print "OK"
33else:
34 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
35 libxml2.dumpMemory()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette