bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Increased RAM memory usage in gawk 5.0.1 compared to gawk


From: Andrew J. Schorr
Subject: Re: [bug-gawk] Increased RAM memory usage in gawk 5.0.1 compared to gawk 4.1.4
Date: Wed, 28 Aug 2019 15:22:27 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

Note that this triggers the valref problem:

bash-4.2$ cat /tmp/bug2.awk
{
       s += ("fubar" ~ $1)
}
bash-4.2$ yes | head | ./gawk -f /tmp/bug2.awk
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2
debug: purge_record saving field 1 with refcnt 2

But this does not:

bash-4.2$ cat /tmp/bug3.awk 
{
       s += $1
}
bash-4.2$ yes | head | ./gawk -f /tmp/bug3.awk

Here's a dump of bug2:

gawk> dump

[      :0x247b258] Op_newfile          : [target_jmp = 0x2479e98] 
[target_endfile = 0x2479ec0]
                                         [target_get_record = 0x2479f10]
[      :0x2479ee8] Op_no_op            : 
[      :0x247a1b8] Op_after_beginfile  : 
[      :0x2479f10] Op_get_record       : [target_newfile = 0x247b258]

        # Rule

[     1:0x247c758] Op_rule             : [in_rule = Rule] [source_file = 
/tmp/bug2.awk]
[     2:0x2479fd8] Op_push_i           : "fubar" [MALLOC|STRING|STRCUR]
[     2:0x247a078] Op_push_i           : 1 [MALLOC|NUMCUR|NUMBER|NUMINT]
[     2:0x247a050] Op_field_spec       : 
[     2:0x247a028] Op_match            : 
[     2:0x247a0a0] Op_parens           : 
[     2:0x2479f60] Op_push_lhs         : s [do_reference = true]
[     2:0x2479f88] Op_assign_plus      : 
[      :0x2479fb0] Op_pop              : 
[      :0x247a0c8] Op_no_op            : 
[      :0x247a190] Op_jmp              : [target_jmp = 0x2479f10]
[      :0x2479ec0] Op_no_op            : 
[      :0x247a168] Op_after_endfile    : 
[      :0x2479e98] Op_no_op            : 
[      :0x2479f38] Op_atexit           : 
[      :0x247a0f0] Op_stop             : 

It looks like Op_field_spec calls r_get_field and then UPREF(r). Somehow
the reference counter must not be getting decremented...

Regards,
Andy



reply via email to

[Prev in Thread] Current Thread [Next in Thread]