[Top][All Lists]

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

Re: [bug-gawk] Memory leak

From: Stephane Delsert
Subject: Re: [bug-gawk] Memory leak
Date: Thu, 30 Mar 2017 16:26:20 +0000

Thanks Andrew,


I did the modification but  that seems that doesn’t work :  I reach 1gb of memory  for almost 60 MM of records and that still growth


Best regards,





-----Original Message-----
From: Andrew J. Schorr [mailto:address@hidden
Sent: jeudi 30 mars 2017 17:20
To: Stephane Delsert <address@hidden>
Cc: address@hidden; address@hidden
Subject: Re: [bug-gawk] Memory leak




> ==19925== 11,301,792 bytes in 117,727 blocks are still reachable in loss record 124 of 124

> ==19925==    at 0x4A0717A: malloc (vg_replace_malloc.c:298)

> ==19925==    by 0x480FDE: emalloc_real (awk.h:1820)

> ==19925==    by 0x482599: bcalloc (symbol.c:722)

> ==19925==    by 0x40BBDA: assoc_list (array.c:1329)

> ==19925==    by 0x4477C9: r_interpret (interpret.h:900)

> ==19925==    by 0x4605F8: main (main.c:518)


This is what worries me. It does seem to correspond to a leak related to using a user-defined sorting function. Looking at the code, I don't see why it's not getting freed, unless this test is bailing out early before we free the allocated instruction below:


        if (list == NULL || ! cmp_func || (assoc_kind & (AASC|ADESC)) != 0)

                                return list;    /* empty list or unsorted, or list already sorted */


We know that cmp_func is not NULL, but perhaps list is NULL or the assoc_kind flags were modified by symbol->alist. If this test fails, then we return before we pop the instruction and free it, so it's still on the stack and reachable...


Does the attached, not well-tested, patch fix your memory leak?




The information contained in this communication is confidential, is
intended only for the use of the recipient named above, and may be legally

If the reader of this message is not the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.

If you have received this communication in error, please resend this
communication to the sender and delete the original message or any copy
of it from your computer system.

Thank You.

reply via email to

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