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: arnold
Subject: Re: [bug-gawk] Increased RAM memory usage in gawk 5.0.1 compared to gawk 4.1.4
Date: Sun, 25 Aug 2019 06:09:23 -0600
User-agent: Heirloom mailx 12.5 7/5/10

Hi.

Finn Magnusson via bug-gawk <address@hidden> wrote:

> Dear gawk developers
>
> Our team recently started using gawk 5.0.1 and found that the RAM memory
> usage seems to have increased compared to gawk version 4.1.4, which we
> were using before.

Please try this fix against unmodified gawk 5.0.1, and let me know
if it also solves the problem for you. In my testing it did.

Thanks,

Arnold

---------------------------------------------------
diff --git a/builtin.c b/builtin.c
index bea88b86..15729484 100644
--- a/builtin.c
+++ b/builtin.c
@@ -735,7 +735,7 @@ format_tree(
        static const char lchbuf[] = "0123456789abcdef";
        static const char Uchbuf[] = "0123456789ABCDEF";
 
-#define INITIAL_OUT_SIZE       512
+#define INITIAL_OUT_SIZE       64
        emalloc(obuf, char *, INITIAL_OUT_SIZE, "format_tree");
        obufout = obuf;
        osiz = INITIAL_OUT_SIZE;
@@ -1647,7 +1647,8 @@ mpf1:
        }
        bchunk(s0, s1 - s0);
        olen_final = obufout - obuf;
-       if (ofre > 0)
+#define GIVE_BACK_SIZE (INITIAL_OUT_SIZE * 2)
+       if (ofre > GIVE_BACK_SIZE)
                erealloc(obuf, char *, olen_final + 1, "format_tree");
        r = make_str_node(obuf, olen_final, ALREADY_MALLOCED);
        obuf = NULL;



reply via email to

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