Re: [xml] Memory Leaks in parse3.c example
- From: Chris Johnson <chris dolphtech com>
- To: Bjorn Reese <breese mail1 stofanet dk>
- Cc: xml gnome org
- Subject: Re: [xml] Memory Leaks in parse3.c example
- Date: Wed, 09 Aug 2006 09:58:41 -0400
Bjorn Reese wrote:
Chris Johnson wrote:
While working with parser3.c example
(http://xmlsoft.org/examples/parse3.c) on Solaris 8 Rational Purify
identifies several areas as having leaked memory.
Normally Purify reports how many bytes have been leaked and a stacktrace
of where the memory was allocated. I don't see either in the output you
posted. Could you post the full output from Purify? (IIRC, you can unset
the DISPLAY environment variable to get the output on the console).
Bjorn -
Thanks for the reply. I've done further testing and found some very
interesting results as follows. It turns out when I compile and link
parse3.c with static version of libxml purify turns up several memory
leaks as shown in the attached a.out.static. Thinking the leaks are
false positives I modified parse3.c to include a "while(1)" around
"example3Func()" it clearly leaks as shown using top.
When compiling and linking parse3.c to use dynamic version of libxml no
leaks occur as illustrated in the attached a.out.dyn file. Again after
modifying the parse3.c to confirm the findings from purify to include
the "while(1)" and examining the the process using top it clearly is not
leaking any memory.
Compile and Link line:
Static:
gcc -g -I/export/home/chris/dev/oem/include/libxml2 -L/usr/local/lib
parse3.c -lsocket -lnsl -lm -lz -liconv
/export/home/chris/dev/oem/lib/libxml2.a
Dynamic:
gcc -g -I/export/home/chris/dev/oem/include/libxml2
-L/export/home/chris/dev/oem/lib -L/usr/local/lib parse3.c -lxml2
-lsocket -lnsl -lm -lz -liconv
OS: Solaris 8
gcc version: 3.4.2
libxml version : 2.6.26
Thanks
..Chris
**** Purify instrumented a.out (pid 18926 at Wed Aug 9 09:26:41 2006)
* Purify 2003a.06.13 Solaris 2 (32-bit) (c) Copyright IBM Corp. 1992, 2004 All rights reserved.
* For contact information type: "purify -help"
* For Purify Viewer output, set the DISPLAY environment variable.
* Options settings: -purify \
-purify-home=/usr/local/releases/purify.sol.2003a.06.13 \
-gcc3_path=/usr/local/bin/gcc \
-cache-dir=/usr/local/releases/purify.sol.2003a.06.13/cache \
-demangle_program=/usr/local/bin/c++filt -threads=yes \
-use-internal-locks=yes -thread_stack_change=0x4000 -mt_safe_malloc=yes
* License successfully checked out.
**** Purify instrumented a.out (pid 18926) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc0 on the stack.
* Address 0xffbeecc0 is 16 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18926) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc4 on the stack.
* Address 0xffbeecc4 is 12 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18926) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc8 on the stack.
* Address 0xffbeecc8 is 8 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18926) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeeccc on the stack.
* Address 0xffbeeccc is 4 bytes below frame pointer in function check_nlspath_env.
* Command-line: ./a.out
**** Purify instrumented a.out (pid 18926) ****
Current file descriptors in use: 5
FIU: file descriptor 0: <stdin>
FIU: file descriptor 1: <stdout>
FIU: file descriptor 2: <stderr>
FIU: file descriptor 26: <reserved for Purify internal use>
FIU: file descriptor 27: <reserved for Purify internal use>
**** Purify instrumented a.out (pid 18926) ****
Purify: Searching for all memory leaks...
Memory leaked: 0 bytes (0%); potentially leaked: 0 bytes (0%)
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 0 0
Potentially Leaked 0 0
In-Use 1 4
----------------------------------------
Total Allocated 1 4
**** Purify instrumented a.out (pid 18926) ****
Thread Summary : 7 threads in existence
* Thread 0 [main thread]
Stack Limit : (0xff3f0000 0xffbf0000), size = 0x800000
* Thread 1
Stack Limit : (0xfe310000 0xfe410000), size = 0x100000
Stack Use : (0xfe40fa30 0xfe40fd54), size = 0x324
* Thread 2
Stack Limit : (0xfd8f2000 0xfd8f6000), size = 0x4000
Stack Use : (0xfd8f5978 0xfd8f5d54), size = 0x3dc
* Thread 3
Stack Limit : (0xfec4da14 0xfec692a8), size = 0x1b894
Stack Use : (0xfec52700 0xfec527a4), size = 0xa4
* Thread 4
Stack Limit : (0xfe20e000 0xfe30e000), size = 0x100000
Stack Use : (0xfe30db18 0xfe30dd54), size = 0x23c
* Thread 5
Stack Limit : (0xfd872000 0xfd874000), size = 0x2000
Stack Use : (0xfd873b28 0xfd873d54), size = 0x22c
* Thread 6
Stack Limit : (0xfd862000 0xfd866000), size = 0x4000
Stack Use : (0xfd865b28 0xfd865d54), size = 0x22c
**** Purify instrumented a.out (pid 18926) ****
* Program exited with status code 0.
* 4 access errors, 4 total occurrences.
* 0 bytes leaked.
* 0 bytes potentially leaked.
* Basic memory usage (including Purify overhead):
377068 code
115548 data/bss
25240 heap (peak use)
4048 stack
* Shared library memory usage (including Purify overhead):
992 libpure_solaris2_init.so.1 (shared code)
280 libpure_solaris2_init.so.1 (private data)
1846968 libxml2.so.2_pure_p3_c0_108201622_58_32 (shared code)
48884 libxml2.so.2_pure_p3_c0_108201622_58_32 (private data)
57676 libsocket.so.1_pure_p3_c0_108201622_58_32 (shared code)
4984 libsocket.so.1_pure_p3_c0_108201622_58_32 (private data)
1031864 libnsl.so.1_pure_p3_c0_108201622_58_32 (shared code)
67752 libnsl.so.1_pure_p3_c0_108201622_58_32 (private data)
127772 libm.so.1_pure_p3_c0_108201622_58_32 (shared code)
1236 libm.so.1_pure_p3_c0_108201622_58_32 (private data)
87996 libz.so.1_pure_p3_c0_108201622_58_32 (shared code)
6316 libz.so.1_pure_p3_c0_108201622_58_32 (private data)
916888 libiconv.so.2_pure_p3_c0_108201622_58_32 (shared code)
24852 libiconv.so.2_pure_p3_c0_108201622_58_32 (private data)
1106340 libc.so.1_pure_p3_c0_108201622_58_32 (shared code)
31276 libc.so.1_pure_p3_c0_108201622_58_32 (private data)
2512 libdl.so.1_pure_p3_c0_108201622_58_32 (shared code)
76 libdl.so.1_pure_p3_c0_108201622_58_32 (private data)
15416 libinternal_stubs.so.1 (shared code)
1044 libinternal_stubs.so.1 (private data)
17452 libpthread.so.1_pure_p3_c0_108201622_58_32 (shared code)
288 libpthread.so.1_pure_p3_c0_108201622_58_32 (private data)
49048 libgcc_s.so.1_pure_p3_c0_108201622_58_32 (shared code)
2396 libgcc_s.so.1_pure_p3_c0_108201622_58_32 (private data)
16552 libmp.so.2_pure_p3_c0_108201622_58_32 (shared code)
892 libmp.so.2_pure_p3_c0_108201622_58_32 (private data)
4500 libdoor.so.1_pure_p3_c0_108201622_58_32 (shared code)
572 libdoor.so.1_pure_p3_c0_108201622_58_32 (private data)
14084 libc_psr.so.1_pure_p3_c0_108201622_58_32 (shared code)
76 libc_psr.so.1_pure_p3_c0_108201622_58_32 (private data)
179976 libthread.so.1_pure_p3_c0_108201622_58_32 (shared code)
119464 libthread.so.1_pure_p3_c0_108201622_58_32 (private data)
* Memory mapped usage:
1048576 mmap'd at 0xfdc02000
1048576 mmap'd at 0xfdd04000
1048576 mmap'd at 0xfde06000
1048576 mmap'd at 0xfdf08000
1048576 mmap'd at 0xfe00a000
1048576 mmap'd at 0xfe10c000
1048576 mmap'd at 0xfe20e000
1048576 mmap'd at 0xfe310000
16384 mmap'd at 0xfd862000
8192 mmap'd at 0xfd872000
16384 mmap'd at 0xfd8f2000
8192 mmap'd PROT_NONE at 0xfdc00000
8192 mmap'd PROT_NONE at 0xfd860000
8192 mmap'd PROT_NONE at 0xfd870000
8192 mmap'd PROT_NONE at 0xfd8f0000
8192 mmap'd PROT_NONE at 0xfe30e000
8192 mmap'd PROT_NONE at 0xfe20c000
8192 mmap'd PROT_NONE at 0xfe10a000
8192 mmap'd PROT_NONE at 0xfe008000
8192 mmap'd PROT_NONE at 0xfdf06000
8192 mmap'd PROT_NONE at 0xfde04000
8192 mmap'd PROT_NONE at 0xfdd02000
**** Purify instrumented a.out (pid 18949 at Wed Aug 9 09:28:25 2006)
* Purify 2003a.06.13 Solaris 2 (32-bit) (c) Copyright IBM Corp. 1992, 2004 All rights reserved.
* For contact information type: "purify -help"
* For Purify Viewer output, set the DISPLAY environment variable.
* Options settings: -purify \
-purify-home=/usr/local/releases/purify.sol.2003a.06.13 \
-gcc3_path=/usr/local/bin/gcc \
-cache-dir=/usr/local/releases/purify.sol.2003a.06.13/cache \
-demangle_program=/usr/local/bin/c++filt
* License successfully checked out.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc0 on the stack.
* Address 0xffbeecc0 is 16 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc4 on the stack.
* Address 0xffbeecc4 is 12 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeecc8 on the stack.
* Address 0xffbeecc8 is 8 bytes below frame pointer in function check_nlspath_env.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
check_nlspath_env [nlspath_checks.c]
_init [libc.so.1]
call_init [util.c]
setup [setup.c]
_setup [_setup.c]
_rt_boot []
* Reading 4 bytes from 0xffbeeccc on the stack.
* Address 0xffbeeccc is 4 bytes below frame pointer in function check_nlspath_env.
* Command-line: ./a.out
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlGenericError [globals.c:857]
xmlInitParser [parser.c:12737]
xmlCheckVersion [parserInternals.c:73]
main [parse3.c:47]
* Reading 4 bytes from 0xffbeedfc on the stack.
* Address 0xffbeedfc is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlGenericError [globals.c:857]
initGenericErrorDefaultFunc [error.c:93]
xmlInitParser [parser.c:12739]
xmlCheckVersion [parserInternals.c:73]
* Reading 4 bytes from 0xffbeed8c on the stack.
* Address 0xffbeed8c is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDefaultSAXHandler [globals.c:821]
xmlDefaultSAXHandlerInit [SAX2.c:2770]
xmlInitParser [parser.c:12744]
xmlCheckVersion [parserInternals.c:73]
* Reading 4 bytes from 0xffbeed8c on the stack.
* Address 0xffbeed8c is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__htmlDefaultSAXHandler [globals.c:699]
htmlDefaultSAXHandlerInit [SAX2.c:2827]
xmlInitParser [parser.c:12751]
xmlCheckVersion [parserInternals.c:73]
* Reading 4 bytes from 0xffbeed8c on the stack.
* Address 0xffbeed8c is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDefaultSAXHandler [globals.c:821]
xmlDefaultSAXHandlerInit [SAX2.c:2770]
xmlInitParserCtxt [parserInternals.c:1513]
xmlNewParserCtxt [parserInternals.c:1767]
* Reading 4 bytes from 0xffbeec34 on the stack.
* Address 0xffbeec34 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlLoadExtDtdDefaultValue [globals.c:969]
xmlInitParserCtxt [parserInternals.c:1631]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDoValidityCheckingDefaultValue [globals.c:840]
xmlInitParserCtxt [parserInternals.c:1632]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlPedanticParserDefaultValue [globals.c:1012]
xmlInitParserCtxt [parserInternals.c:1633]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlLineNumbersDefaultValue [globals.c:952]
xmlInitParserCtxt [parserInternals.c:1634]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlKeepBlanksDefaultValue [globals.c:935]
xmlInitParserCtxt [parserInternals.c:1635]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlSubstituteEntitiesDefaultValue [globals.c:1046]
xmlInitParserCtxt [parserInternals.c:1650]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDefaultBufferSize [globals.c:803]
xmlAllocParserInputBuffer [xmlIO.c:2126]
xmlParserInputBufferCreateMem [xmlIO.c:2621]
xmlCreateMemoryParserCtxt [parser.c:12415]
* Reading 4 bytes from 0xffbeeca4 on the stack.
* Address 0xffbeeca4 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlBufferAllocScheme [globals.c:786]
xmlBufferCreateSize [tree.c:6546]
xmlAllocParserInputBuffer [xmlIO.c:2126]
xmlParserInputBufferCreateMem [xmlIO.c:2621]
* Reading 4 bytes from 0xffbeec34 on the stack.
* Address 0xffbeec34 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDefaultSAXLocator [globals.c:831]
xmlParseDocument [parser.c:9061]
xmlDoRead [parser.c:13140]
example3Func [parse3.c:33]
* Reading 4 bytes from 0xffbeed7c on the stack.
* Address 0xffbeed7c is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlDefaultSAXHandler [globals.c:821]
xmlFreeParserCtxt [parserInternals.c:1690]
xmlDoRead [parser.c:13151]
example3Func [parse3.c:33]
* Reading 4 bytes from 0xffbeed84 on the stack.
* Address 0xffbeed84 is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
UMR: Uninitialized memory read:
* This is occurring while in:
_libc_pthread_getspecific [libc.so.1]
xmlGetGlobalState [threads.c:533]
__xmlLastError [globals.c:709]
xmlResetLastError [error.c:891]
xmlCleanupParser [parser.c:12789]
main [parse3.c:54]
* Reading 4 bytes from 0xffbeedfc on the stack.
* Address 0xffbeedfc is 4 bytes below frame pointer in function _libc_pthread_getspecific.
**** Purify instrumented a.out (pid 18949) ****
Current file descriptors in use: 5
FIU: file descriptor 0: <stdin>
FIU: file descriptor 1: <stdout>
FIU: file descriptor 2: <stderr>
FIU: file descriptor 26: <reserved for Purify internal use>
FIU: file descriptor 27: <reserved for Purify internal use>
**** Purify instrumented a.out (pid 18949) ****
Purify: Searching for all memory leaks...
Memory leaked: 8216 bytes (99.7%); potentially leaked: 0 bytes (0%)
MLK: 512 bytes leaked at 0x225f38
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlGenericError [globals.c:857]
xmlInitParser [parser.c:12737]
xmlCheckVersion [parserInternals.c:73]
main [parse3.c:47]
MLK: 512 bytes leaked at 0x226200
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlGenericError [globals.c:857]
initGenericErrorDefaultFunc [error.c:93]
xmlInitParser [parser.c:12739]
xmlCheckVersion [parserInternals.c:73]
MLK: 512 bytes leaked at 0x226c98
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDefaultSAXHandler [globals.c:821]
xmlDefaultSAXHandlerInit [SAX2.c:2770]
xmlInitParser [parser.c:12744]
xmlCheckVersion [parserInternals.c:73]
MLK: 512 bytes leaked at 0x226ef0
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__htmlDefaultSAXHandler [globals.c:699]
htmlDefaultSAXHandlerInit [SAX2.c:2827]
xmlInitParser [parser.c:12751]
xmlCheckVersion [parserInternals.c:73]
MLK: 512 bytes leaked at 0x227358
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDefaultSAXHandler [globals.c:821]
xmlDefaultSAXHandlerInit [SAX2.c:2770]
xmlInitParserCtxt [parserInternals.c:1513]
xmlNewParserCtxt [parserInternals.c:1767]
MLK: 512 bytes leaked at 0x228280
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlLoadExtDtdDefaultValue [globals.c:969]
xmlInitParserCtxt [parserInternals.c:1631]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x2284d8
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDoValidityCheckingDefaultValue [globals.c:840]
xmlInitParserCtxt [parserInternals.c:1632]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x228730
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlPedanticParserDefaultValue [globals.c:1012]
xmlInitParserCtxt [parserInternals.c:1633]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x228988
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlLineNumbersDefaultValue [globals.c:952]
xmlInitParserCtxt [parserInternals.c:1634]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x228be0
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlKeepBlanksDefaultValue [globals.c:935]
xmlInitParserCtxt [parserInternals.c:1635]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x228e38
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlSubstituteEntitiesDefaultValue [globals.c:1046]
xmlInitParserCtxt [parserInternals.c:1650]
xmlNewParserCtxt [parserInternals.c:1767]
xmlCreateMemoryParserCtxt [parser.c:12410]
MLK: 512 bytes leaked at 0x229108
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDefaultBufferSize [globals.c:803]
xmlAllocParserInputBuffer [xmlIO.c:2126]
xmlParserInputBufferCreateMem [xmlIO.c:2621]
xmlCreateMemoryParserCtxt [parser.c:12415]
MLK: 512 bytes leaked at 0x2293c8
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlBufferAllocScheme [globals.c:786]
xmlBufferCreateSize [tree.c:6546]
xmlAllocParserInputBuffer [xmlIO.c:2126]
xmlParserInputBufferCreateMem [xmlIO.c:2621]
MLK: 512 bytes leaked at 0x22bc28
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDefaultSAXLocator [globals.c:831]
xmlParseDocument [parser.c:9061]
xmlDoRead [parser.c:13140]
example3Func [parse3.c:33]
MLK: 512 bytes leaked at 0x22c210
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlDefaultSAXHandler [globals.c:821]
xmlFreeParserCtxt [parserInternals.c:1690]
xmlDoRead [parser.c:13151]
example3Func [parse3.c:33]
MLK: 512 bytes leaked at 0x22c468
* This memory was allocated from:
malloc [rtlib.o]
xmlGetGlobalState [threads.c:455]
__xmlLastError [globals.c:709]
xmlResetLastError [error.c:891]
xmlCleanupParser [parser.c:12789]
main [parse3.c:54]
MLK: 24 bytes leaked at 0x226190
* This memory was allocated from:
malloc [rtlib.o]
xmlNewMutex [threads.c:180]
xmlInitGlobals [globals.c:49]
xmlInitializeGlobalState [globals.c:495]
xmlGetGlobalState [threads.c:460]
__xmlGenericError [globals.c:857]
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 17 8216
Potentially Leaked 0 0
In-Use 1 24
----------------------------------------
Total Allocated 18 8240
**** Purify instrumented a.out (pid 18949) ****
* Program exited with status code 0.
* 20 access errors, 20 total occurrences.
* 8216 bytes leaked.
* 0 bytes potentially leaked.
* Basic memory usage (including Purify overhead):
1981956 code
139516 data/bss
32768 heap (peak use)
4048 stack
* Shared library memory usage (including Purify overhead):
992 libpure_solaris2_init.so.1 (shared code)
280 libpure_solaris2_init.so.1 (private data)
57676 libsocket.so.1_pure_p3_c0_108201622_58_32 (shared code)
4984 libsocket.so.1_pure_p3_c0_108201622_58_32 (private data)
1031864 libnsl.so.1_pure_p3_c0_108201622_58_32 (shared code)
67752 libnsl.so.1_pure_p3_c0_108201622_58_32 (private data)
127772 libm.so.1_pure_p3_c0_108201622_58_32 (shared code)
1236 libm.so.1_pure_p3_c0_108201622_58_32 (private data)
87996 libz.so.1_pure_p3_c0_108201622_58_32 (shared code)
6316 libz.so.1_pure_p3_c0_108201622_58_32 (private data)
916888 libiconv.so.2_pure_p3_c0_108201622_58_32 (shared code)
24852 libiconv.so.2_pure_p3_c0_108201622_58_32 (private data)
1106340 libc.so.1_pure_p3_c0_108201622_58_32 (shared code)
31276 libc.so.1_pure_p3_c0_108201622_58_32 (private data)
2512 libdl.so.1_pure_p3_c0_108201622_58_32 (shared code)
76 libdl.so.1_pure_p3_c0_108201622_58_32 (private data)
15416 libinternal_stubs.so.1 (shared code)
1044 libinternal_stubs.so.1 (private data)
16552 libmp.so.2_pure_p3_c0_108201622_58_32 (shared code)
892 libmp.so.2_pure_p3_c0_108201622_58_32 (private data)
4500 libdoor.so.1_pure_p3_c0_108201622_58_32 (shared code)
572 libdoor.so.1_pure_p3_c0_108201622_58_32 (private data)
14084 libc_psr.so.1_pure_p3_c0_108201622_58_32 (shared code)
76 libc_psr.so.1_pure_p3_c0_108201622_58_32 (private data)
/**
* section: Parsing
* synopsis: Parse an XML document in memory to a tree and free it
* purpose: Demonstrate the use of xmlReadMemory() to read an XML file
* into a tree and and xmlFreeDoc() to free the resulting tree
* usage: parse3
* test: parse3
* author: Daniel Veillard
* copy: see Copyright for the status of this software.
*/
#include <stdio.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
static const char *document = "<doc/>";
/**
* example3Func:
* @content: the content of the document
* @length: the length in bytes
*
* Parse the in memory document and free the resulting tree
*/
static void
example3Func(const char *content, int length) {
xmlDocPtr doc; /* the resulting document tree */
/*
* The document being in memory, it have no base per RFC 2396,
* and the "noname.xml" argument will serve as its base.
*/
doc = xmlReadMemory(content, length, "noname.xml", NULL, 0);
if (doc == NULL) {
fprintf(stderr, "Failed to parse document\n");
return;
}
xmlFreeDoc(doc);
}
int main(void) {
/*
* this initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
* library used.
*/
LIBXML_TEST_VERSION
example3Func(document, 6);
/*
* Cleanup function for the XML library.
*/
xmlCleanupParser();
/*
* this is to debug memory for regression tests
*/
xmlMemoryDump();
return(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]