VirtualBox

source: vbox/trunk/src/libs/libxml2-2.6.30/python/tests/tstmem.py@ 8268

最後變更 在這個檔案從8268是 6076,由 vboxsync 提交於 17 年 前

Merged dmik/s2 branch (r25959:26751) to the trunk.

  • 屬性 svn:eol-style 設為 native
  • 屬性 svn:keywords 設為 Date Revision Author Id
檔案大小: 717 位元組
 
1#!/usr/bin/python -u
2import libxml2
3import libxml2mod
4import sys
5
6def error(msg, data):
7 pass
8
9# Memory debug specific
10libxml2.debugMemory(1)
11
12dtd="""<!ELEMENT foo EMPTY>"""
13instance="""<?xml version="1.0"?>
14<foo></foo>"""
15
16dtd = libxml2.parseDTD(None, 'test.dtd')
17ctxt = libxml2.newValidCtxt()
18libxml2mod.xmlSetValidErrors(ctxt._o, error, error)
19doc = libxml2.parseDoc(instance)
20ret = doc.validateDtd(ctxt, dtd)
21if ret != 1:
22 print "error doing DTD validation"
23 sys.exit(1)
24
25doc.freeDoc()
26dtd.freeDtd()
27del dtd
28del ctxt
29
30# Memory debug specific
31libxml2.cleanupParser()
32if libxml2.debugMemory(1) == 0:
33 print "OK"
34else:
35 print "Memory leak %d bytes" % (libxml2.debugMemory(1))
36 libxml2.dumpMemory()
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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