[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strong regexp: sub() memory leaks
From: |
arnold |
Subject: |
Re: strong regexp: sub() memory leaks |
Date: |
Tue, 21 Jan 2025 12:03:21 -0700 |
User-agent: |
Heirloom mailx 12.5 7/5/10 |
Thanks for the report. I see this with valgrind.
I will investigate it and I hope come up with a fix.
Arnold
Denis Shirokov <cosmogen@gmail.com> wrote:
> Hi GAWK Team!
>
> found memory leaking while transforming "strong regexp" to "strong regexp"
> using sub() or gsub():
>
> to reproduce this issue run attached (example.gwk) script using:
>
> gawk -f ./example.gwk
>
> then check current memory gawk usage amount (attached screenshot in
> regex.bmp == 1400 MB)
>
> you may also run attached script with replacing 'r = @//' by 'r = ""' at
> the begining of script
> and see the memory usage in case if string-to-string conversion performed
> by sub() (screenshot attached str.bmp == 1.7 MB)
>
> It seems that sub() generates a new microcode each time a variable is
> assigned a value of type strong regex.
> Is it possible to modify this so that the processing of the strong regex
> occurs at the moment of its application rather than at the moment of
> assignment?
> For example, let it work as a dynamic regular expression...
>
> Regards
> Denis