This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/592: Serious memory leak and slow perf of call foo()/print foo() commands


>Number:         592
>Category:       gdb
>Synopsis:       Serious memory leak and slow perf of call foo()/print foo() commands
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 30 01:28:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Stephane Carrez
>Release:        5.2
>Organization:
>Environment:
i686-pc-linux-gnu
Using the following gcc (but it's not related to it):
/usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
gcc version 2.96 20000731 (Mandrake Linux 8.2 2.96-0.76mdk)
>Description:
There is a serious memory leak when we use the call foo() or
print foo() commands.  The problem shows up clearly with
C++ programs that have big symbol tables (due to template
instantiations).

Gdb's process eats 140Mb after each call bar(0).

The C++ prog attached does nothing useful but instantiates
several STL map templates.
>How-To-Repeat:
Compile the example with:

g++ -o tst tst.C -g
Try in gdb:

gdb tst
(gdb) b main
#  At this step, gdb uses 15Mb
(gdb) run
(gdb) call bar(0)
# the command is slow and gdb now uses 157Mb
(gdb) call bar(0)
# Likewise and it reached 297Mb
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="tst.C"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="tst.C"

I2luY2x1ZGUgPG1hcD4KI2luY2x1ZGUgPHN0cmluZz4KCnN0cnVjdCB0ZXN0IAp7CiAgbG9uZyBh
OwogIGxvbmcgYjsKfTsKCnR5cGVkZWYgbWFwPHN0cmluZyx0ZXN0PiB0ZXN0X21hcDsKdHlwZWRl
ZiBtYXA8c3RyaW5nLGNoYXI+IGNoYXJfbWFwOwp0eXBlZGVmIG1hcDxzdHJ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190cGw8aHVnZV9tYXA+IGh1Z2UyX21hcDsKdHlwZWRlZiBiaWdfdHBs
PGh1Z2UyX21hcD4gaHVnZTNfbWFwOwp0eXBlZGVmIGJpZ190cGw8aHVnZTNfbWFwPiBodWdlNF9t
YXA7CgppbnQgZ2V0KHN0cmluZyYgbmFtZSwgbWFwbWFwJiBtcCkKewogIHN0cnVjdCBtYXBfc2V2
ZXJhbCYgcyA9IG1wW25hbWVdOwogIAogIHJldHVybiBzLmxbbmFtZV07Cn0KCmludCBiYXIoaW50
IGkpCnsKICByZXR1cm4gaSArIDE7Cn0KCnZvaWQgZmlsbChiaWdfbWFwJiBtYXApCnsKICBzdHJp
bmcgbmFtZSA9ICJhIjsKICAKICBmb3IgKGludCBpID0gMDsgaSA8IDEwOyBpKyspCiAgICB7CiAg
ICAgIG5hbWUgPSAiYSIgKyAoY2hhcikgKCcwJyArIGkpOwogICAgICBzdHJ1Y3QgYmlnJiBiID0g
bWFwW25hbWVdOwogICAgICBtYXBtYXAmIG0gPSBiLnQ2W25hbWVdOwogICAgfQp9CgppbnQgbWFp
bigpCnsKICBiaWdfbWFwIHRoZWJpZ21hcDsKICAKICBmaWxsKHRoZWJpZ21hcCk7Cn0KCg==


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]