bug-gawk
[Top][All Lists]
Advanced

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

strong regexp: sub() memory leaks


From: Denis Shirokov
Subject: strong regexp: sub() memory leaks
Date: Tue, 21 Jan 2025 19:20:48 +0200

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

Attachment: example.gwk
Description: Binary data

Attachment: str.bmp
Description: Windows bitmap

Attachment: regex.bmp
Description: Windows bitmap


reply via email to

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