This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cpp memory leaks
- To: gcc-bugs at gcc dot gnu dot org
- Subject: cpp memory leaks
- From: Martin Stromberg <Martin dot Stromberg at lu dot erisoft dot se>
- Date: Wed, 3 May 2000 17:39:13 +0200 (MET DST)
cpp leaks memory like nothing else. Let me know if this is useful and if you want me to try something else.
Thanks,
MartinS
Run 1.
**** Purify instrumented ./cpp (pid 12892 at Wed May 3 17:16:11 2000)
* Purify 4.1 Solaris 2, Copyright (C) 1992-1997 Rational Software Corp. All rights reserved.
* For contact information type: "purify -help"
* For TTY output, use the option "-windows=no"
* Command-line: ./cpp -lang-c -I. -I../../gcc -I../../gcc/config \
-I../../gcc/../include -iprefix \
./../lib/gcc-lib/sparc-sun-solaris2.6/2.96/ -isystem ./include -isystem \
/usr/local/sparc-sun-solaris2.6/bin/include -D__GNUC__=2 \
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -Dsparc -Dsun -Dunix \
-D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 \
-D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -g -g0 \
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) -DIN_GCC -DSVR4 \
-DCRT_END -isystem /usr/local/sparc-sun-solaris2.6/include -isystem \
./include ../../gcc/crtstuff.c /var/tmp/cc12VqNc.i
* Options settings: -purify -purify-home=/local/pure/purify/4.1
* Purify licensed to Erisoft or Erisoft AB
* Purify checking enabled.
**** Purify instrumented ./cpp (pid 12892) ****
UMR: Uninitialized memory read:
* This is occurring while in:
collect_funlike_expansion [cpphash.c:575]
_cpp_create_definition [cpphash.c:908]
do_define [cpplib.c:380]
_cpp_handle_directive [cpplib.c:306]
cpp_get_token [cpplex.c:1597]
cpp_scan_buffer [cpplex.c:400]
* Reading 4 bytes from 0xcba34 in the heap.
* Address 0xcba34 is 220 bytes into a malloc'd block at 0xcb958 of 4112 bytes.
* This block was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
init_token_list [cpplex.c:472]
_cpp_init_input_buffer [cpplex.c:2037]
cpp_start_read [cppinit.c:897]
main [cppmain.c:72]
**** Purify instrumented ./cpp (pid 12892) ****
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 ./cpp (pid 12892) ****
Purify: Searching for all memory leaks...
Memory leaked: 698 bytes (10.8%); potentially leaked: 4112 bytes (63.5%)
MLK: 166 bytes leaked in 3 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
xstrdup [xstrdup.c:20]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
main [cppmain.c:72]
* Block of 90 bytes at 0xcfbc0
* Block of 57 bytes at 0xcf8e8
* Block of 19 bytes at 0xcf688
MLK: 147 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
translate_name [prefix.c:280]
update_path [prefix.c:298]
initialize_standard_includes [cppinit.c:840]
* Block of 90 bytes at 0xcfb08
* Block of 57 bytes at 0xcf850
MLK: 140 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
update_path [prefix.c:295]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
* Block of 89 bytes at 0xcf9e8
* Block of 51 bytes at 0xcf758
MLK: 135 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
initialize_standard_includes [cppinit.c:818]
cpp_start_read [cppinit.c:901]
main [cppmain.c:72]
_start [crt1.o]
* Block of 84 bytes at 0xcf5d8
* Block of 51 bytes at 0xcf548
MLK: 84 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
xstrdup [xstrdup.c:20]
handle_option [cppinit.c:1618]
cpp_handle_options [cppinit.c:1755]
main [cppmain.c:59]
* Block of 44 bytes at 0xcb030
* Block of 40 bytes at 0xcb8d8
MLK: 15 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
update_path [prefix.c:293]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
* Block of 10 bytes at 0xcf980
* Block of 5 bytes at 0xcf6f8
MLK: 11 bytes leaked at 0xda498
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
collect_funlike_expansion [cpphash.c:685]
_cpp_create_definition [cpphash.c:908]
do_define [cpplib.c:380]
_cpp_handle_directive [cpplib.c:306]
PLK: 4112 bytes potentially leaked at 0xcb958
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
init_token_list [cpplex.c:472]
_cpp_init_input_buffer [cpplex.c:2037]
cpp_start_read [cppinit.c:897]
main [cppmain.c:72]
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 14 698
Potentially Leaked 1 4112
In-Use 21 1662
----------------------------------------
Total Allocated 36 6472
**** Purify instrumented ./cpp (pid 12892) ****
* Program exited with status code 0.
* 1 access error, 6 total occurrences.
* 698 bytes leaked.
* 4112 bytes potentially leaked.
* Basic memory usage (including Purify overhead):
616903 code
80184 data/bss
81920 heap (peak use)
14200 stack
* Shared library memory usage (including Purify overhead):
963253 libc.so.1_pure_p3_c0_410_56 (shared code)
30952 libc.so.1_pure_p3_c0_410_56 (private data)
2036 libdl.so.1_pure_p3_c0_410_56 (shared code)
4 libdl.so.1_pure_p3_c0_410_56 (private data)
9576 libinternal_stubs.so.1 (shared code)
324 libinternal_stubs.so.1 (private data)
Run 2.
[snip]
...
**** Purify instrumented ./cpp (pid 12906) ****
Purify: Searching for all memory leaks...
Memory leaked: 31987 bytes (61.8%); potentially leaked: 16450 bytes (31.8%)
MLK: 28249 bytes leaked in 221 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
collect_funlike_expansion [cpphash.c:685]
_cpp_create_definition [cpphash.c:908]
do_define [cpplib.c:380]
_cpp_handle_directive [cpplib.c:306]
* Block of 1769 bytes at 0x14dd28
* Block of 1642 bytes at 0xdb580
* Block of 1122 bytes at 0x13ec38
* Block of 1006 bytes at 0xfd638
* Block of 863 bytes at 0x147cb8
* Block of 827 bytes at 0x1393d8
* Block of 662 bytes at 0x12ad90
* Block of 590 bytes at 0x1381f0
* Block of 434 bytes at 0xfb2a8
* Block of 408 bytes (2 times); last block at 0x1252d0
* Block of 407 bytes at 0xf9ac8
* Block of 406 bytes at 0x120bd8
* Block of 389 bytes at 0xfbab0
* Block of 360 bytes at 0xfc278
* Block of 343 bytes at 0xf6078
* Block of 342 bytes at 0x124c68
* Block of 328 bytes at 0xdc608
* Block of 324 bytes (2 times); last block at 0x136830
* Block of 306 bytes at 0x133048
* Block of 298 bytes at 0x142068
* Block of 269 bytes at 0x136588
* Block of 263 bytes at 0x12b170
* Block of 233 bytes at 0xdc0f8
* Block of 220 bytes at 0x12bcd0
* Block of 210 bytes at 0x141a60
* Block of 209 bytes at 0xfa990
* Block of 203 bytes at 0x129898
* Block of 192 bytes at 0x134710
* Block of 189 bytes at 0x11d118
* Block of 185 bytes at 0x11d798
* Block of 182 bytes (2 times); last block at 0x124670
* Block of 181 bytes at 0x12dd10
* Block of 164 bytes at 0x12d2c8
* Block of 162 bytes at 0x13da20
* Block of 161 bytes at 0x1179d8
* Block of 157 bytes (2 times); last block at 0x135ac0
* Block of 152 bytes at 0x11efb0
* Block of 151 bytes at 0x13c7f0
* Block of 150 bytes at 0x10dc98
* Block of 149 bytes at 0x134ef0
* Block of 148 bytes at 0xeccf0
* Block of 143 bytes at 0x12fa30
* Block of 141 bytes (2 times); last block at 0x13b1b8
* Block of 139 bytes at 0xf8220
* Block of 134 bytes at 0xf7f08
* Block of 126 bytes at 0x11bfc0
* Block of 124 bytes at 0x122230
* Block of 122 bytes (2 times); last block at 0x12c028
* Block of 121 bytes (3 times); last block at 0x146758
* Block of 118 bytes at 0xf53d8
* Block of 117 bytes at 0x1461a0
* Block of 114 bytes at 0xf6858
* Block of 113 bytes at 0x1260d8
* Block of 112 bytes (4 times); last block at 0x138b68
* Block of 110 bytes (3 times); last block at 0x125a60
* Block of 108 bytes at 0xecf28
* Block of 107 bytes at 0x117ed8
* Block of 106 bytes (3 times); last block at 0x13caf8
* Block of 105 bytes at 0xf5030
* Block of 104 bytes (2 times); last block at 0x115728
* Block of 101 bytes at 0x13be68
* Block of 100 bytes at 0x135f10
* Block of 99 bytes at 0x11bb40
* Block of 96 bytes at 0x116800
* Block of 93 bytes at 0xf7660
* Block of 92 bytes at 0x11e570
* Block of 91 bytes (2 times); last block at 0x145ce0
* Block of 88 bytes at 0xfa200
* Block of 87 bytes (2 times); last block at 0x156250
* Block of 86 bytes at 0x12b500
* Block of 85 bytes (2 times); last block at 0xf7448
* Block of 84 bytes at 0xf5d28
* Block of 83 bytes (2 times); last block at 0x118fe8
* Block of 82 bytes (3 times); last block at 0x13a880
* Block of 81 bytes at 0x13cf28
* Block of 80 bytes (3 times); last block at 0x13d270
* Block of 78 bytes at 0x146bc0
* Block of 73 bytes (2 times); last block at 0x152020
* Block of 72 bytes at 0x151dc8
* Block of 71 bytes at 0x152358
* Block of 70 bytes at 0xca8a0
* Block of 69 bytes at 0x133ff8
* Block of 68 bytes (2 times); last block at 0x148f80
* Block of 67 bytes at 0x117c88
* Block of 65 bytes (3 times); last block at 0x18fe58
* Block of 61 bytes at 0x12a9d8
* Block of 60 bytes (2 times); last block at 0x12f4e8
* Block of 58 bytes (3 times); last block at 0x126400
* Block of 57 bytes (2 times); last block at 0x139ce8
* Block of 56 bytes at 0x117570
* Block of 54 bytes (5 times); last block at 0x145678
* Block of 53 bytes at 0x106bf8
* Block of 52 bytes (2 times); last block at 0x133810
* Block of 51 bytes at 0x133d40
* Block of 50 bytes (5 times); last block at 0x146ff8
* Block of 49 bytes at 0xf6d58
* Block of 48 bytes at 0xccc10
* Block of 47 bytes at 0x11dce0
* Block of 46 bytes (3 times); last block at 0x11b650
* Block of 45 bytes (2 times); last block at 0x1161f0
* Block of 44 bytes at 0x13a568
* Block of 43 bytes (3 times); last block at 0x1329f8
* Block of 42 bytes at 0x13c118
* Block of 41 bytes (4 times); last block at 0x142a68
* Block of 40 bytes (2 times); last block at 0x152680
* Block of 39 bytes (5 times); last block at 0x141668
* Block of 38 bytes (3 times); last block at 0x119c48
* Block of 37 bytes at 0x11da60
* Block of 35 bytes (3 times); last block at 0x1458c8
* Block of 34 bytes at 0x118370
* Block of 33 bytes (3 times); last block at 0x1901a0
* Block of 32 bytes (5 times); last block at 0x155d20
* Block of 30 bytes (5 times); last block at 0x142730
* Block of 29 bytes (4 times); last block at 0x11bdb0
* Block of 28 bytes at 0xf5660
* Block of 27 bytes at 0xcc208
* Block of 26 bytes (3 times); last block at 0x11ae88
* Block of 25 bytes (4 times); last block at 0x1492d0
* Block of 24 bytes (2 times); last block at 0x174348
* Block of 23 bytes (4 times); last block at 0x15da18
* Block of 22 bytes (2 times); last block at 0x15dc48
* Block of 21 bytes (7 times); last block at 0x1646e0
* Block of 19 bytes at 0x122e38
* Block of 16 bytes (4 times); last block at 0x121d80
* Block of 6 bytes (3 times); last block at 0x13f858
* Block of 5 bytes (4 times); last block at 0x140cf8
MLK: 2520 bytes leaked in 126 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
_cpp_create_definition [cpphash.c:933]
do_define [cpplib.c:380]
_cpp_handle_directive [cpplib.c:306]
cpp_get_token [cpplex.c:1597]
* Block of 20 bytes (126 times); last block at 0x186fb8
MLK: 491 bytes leaked in 34 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
xstrdup [xstrdup.c:20]
do_ifndef [cpplib.c:1197]
_cpp_handle_directive [cpplib.c:306]
cpp_get_token [cpplex.c:1597]
* Block of 22 bytes at 0x13a670
* Block of 21 bytes (2 times); last block at 0x11a978
* Block of 20 bytes at 0x119810
* Block of 18 bytes (2 times); last block at 0x15b250
* Block of 17 bytes (4 times); last block at 0x146d60
* Block of 16 bytes (4 times); last block at 0x1514c0
* Block of 15 bytes (5 times); last block at 0x158480
* Block of 14 bytes (2 times); last block at 0x1519c0
* Block of 13 bytes (2 times); last block at 0x1634c0
* Block of 12 bytes (3 times); last block at 0x154bc0
* Block of 10 bytes (4 times); last block at 0x1645b0
* Block of 9 bytes (2 times); last block at 0xf2ce8
* Block of 8 bytes (2 times); last block at 0x145360
MLK: 166 bytes leaked in 3 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
xstrdup [xstrdup.c:20]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
main [cppmain.c:72]
* Block of 90 bytes at 0xd01c8
* Block of 57 bytes at 0xcfef0
* Block of 19 bytes at 0xcfc90
MLK: 147 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
translate_name [prefix.c:280]
update_path [prefix.c:298]
initialize_standard_includes [cppinit.c:840]
* Block of 90 bytes at 0xd0110
* Block of 57 bytes at 0xcfe58
MLK: 140 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
update_path [prefix.c:295]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
* Block of 89 bytes at 0xcfff0
* Block of 51 bytes at 0xcfd60
MLK: 135 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
initialize_standard_includes [cppinit.c:818]
cpp_start_read [cppinit.c:901]
main [cppmain.c:72]
_start [crt1.o]
* Block of 84 bytes at 0xcfbe0
* Block of 51 bytes at 0xcfb50
MLK: 84 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
xstrdup [xstrdup.c:20]
handle_option [cppinit.c:1618]
cpp_handle_options [cppinit.c:1755]
main [cppmain.c:59]
* Block of 44 bytes at 0xcb3b8
* Block of 40 bytes at 0xcbe00
MLK: 40 bytes leaked at 0x152c20
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
make_IHASH [cppfiles.c:177]
find_include_file [cppfiles.c:313]
_cpp_execute_include [cppfiles.c:570]
do_include [cpplib.c:472]
MLK: 15 bytes leaked in 2 blocks
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
concat [prefix.c:142]
update_path [prefix.c:293]
initialize_standard_includes [cppinit.c:840]
cpp_start_read [cppinit.c:901]
* Block of 10 bytes at 0xcff88
* Block of 5 bytes at 0xcfd00
PLK: 16400 bytes potentially leaked at 0x1493c8
* This memory was allocated from:
malloc [rtlib.o]
realloc [rtlib.o]
xrealloc [xmalloc.c:145]
expand_token_space [cpplex.c:452]
_cpp_scan_line [cpplex.c:532]
do_define [cpplib.c:348]
PLK: 50 bytes potentially leaked at 0x1335d0
* This memory was allocated from:
malloc [rtlib.o]
xmalloc [xmalloc.c:72]
collect_funlike_expansion [cpphash.c:685]
_cpp_create_definition [cpphash.c:908]
do_define [cpplib.c:380]
_cpp_handle_directive [cpplib.c:306]
Purify Heap Analysis (combining suppressed and unsuppressed blocks)
Blocks Bytes
Leaked 395 31987
Potentially Leaked 2 16450
In-Use 43 3282
----------------------------------------
Total Allocated 440 51719
**** Purify instrumented ./cpp (pid 12906) ****
* Program exited with status code 0.
* 1 access error, 6 total occurrences.
* 31987 bytes leaked.
* 16450 bytes potentially leaked.
* Basic memory usage (including Purify overhead):
616903 code
80184 data/bss
819200 heap (peak use)
14568 stack
* Shared library memory usage (including Purify overhead):
963253 libc.so.1_pure_p3_c0_410_56 (shared code)
30952 libc.so.1_pure_p3_c0_410_56 (private data)
2036 libdl.so.1_pure_p3_c0_410_56 (shared code)
4 libdl.so.1_pure_p3_c0_410_56 (private data)
9576 libinternal_stubs.so.1 (shared code)
324 libinternal_stubs.so.1 (private data)