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/1714: large array memory use in C/Fortran


>Number:         1714
>Category:       gdb
>Synopsis:       large array memory use in C/Fortran
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 20 14:38:01 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator:     dsl@sources.redhat.com
>Release:        unknown-1.0
>Organization:
>Environment:
Linux (FC2/RH9); GCC 3.3.3
>Description:
GDB allocates the full amount of memory for an object in read_var_value, even when this is not used.  It looks like it could do with a bit of a restructure to make it truly lazy (I know laziness is in there, but not I'm considering the types where the memory for a value object is allocated as part of the value structure in a contiguous block of memory - as seen in read_var_value of findvar.c for fixed arrays)

For example.. consider big_array in the example.  If print elements is set to 1, only one element is needed when printing big_array.  In other situations, it's likely you really only need a screen-ful at the time (eg. it prompts you if you want to continue).

However, it allocates lots of memory and takes an absolute age to print (a second per element when print elements is at the default setting).

This causes some problems in both C (occasional) and Fortran (frequently with arrays).

>How-To-Repeat:
Compile the above, -g with gcc,

b main
r
print big_array

and look at memory usage, start the clock and watch the elements come out one by one..
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="test_big_array.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="test_big_array.c"

CiNkZWZpbmUgU0laRSAoMTAgKiAxMDAwICogMTAwMCkKCmludCBiaWdfYXJyYXlbU0laRV07Cgpp
bnQgbWFpbigpIHsKICBpbnQgaTsKICBmb3IgKGkgPSAwIDsgaSA8IFNJWkU7IGkrKykgewogICAg
YmlnX2FycmF5W2ldID0gaTsKICB9Cn0K


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