Code Comments
Programming Forum and web based access to our favorite programming groups.Hi All,
I have the following small snippet of awk code
function test(regexp)
{
match($0, regexp)
}
{
test(": ");
test("=");
}
When I execute the above small snippet of code with a big file as
input I get the following
error:
awk: /var/tmp/awk_test:4: (FILENAME=- FNR=5776) fatal: Memory
exhausted: /: /
Output of top command shows that the memory of awk process increases
gradually.
( I am executing this command in UNIX).
Any idea what is the problem ? and How to solve this?
When I tried calling the test() function with the same parameter I did
not see this error.
Also, when I commented the match() function I did not see this error.
So, It looks like their is a memory leak in match() function when it
is called with two different
regular expression. I may be wrong also.
Thanks,
Ram
Post Follow-up to this messageOn Aug 22, 7:42 pm, J=FCrgen Kahrs <Juergen.KahrsDELETET...@vr-web.de> wrote: > Which implementation of the AWK language do you use ? > Which version ? Which Unix ? I am seeing this memory leak in GNU Awk 3.0.6 on 6.2-RELEASE FreeBSD. I do not see this memory leak with the same awk version on 4=2E11-RELEASE-p13 FreeBSD. Thanks, Ram
Post Follow-up to this messageOn Aug 22, 8:24 pm, Ed Morton <mor...@lsupcaemnt.com> wrote: > > You're probably right. I'm curious and it may provide you a workaround: > if you don't mind trying it, what happens when you do either of these: > > 1) and 2) are failing with memory error and remaining steps are working fine. This may not be a workaround for me because I want to execute the match() inside a function by passing the regular exp. Thanks, Ram
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.