source: vendor/trunk/src/libs/libxml2-2.6.31/python/tests/tstmem.py@ 3

Last change on this file since 3 was 3, checked in by dmik, 10 years ago

vendor: Import VirtualBox OSE version 5.0.0 (r56895) from vendor.

Command: svn merge http://www.virtualbox.org/svn/vbox -r 0:56895 .

  • Property svn:eol-style set to native
File size: 717 bytes
Line 
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()
Note: See TracBrowser for help on using the repository browser.