From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | Anderson Valadares <andervalbh(at)gmail(dot)com>, pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #6785: Memory Leak in plpgsql |
Date: | 2012-07-30 16:14:16 |
Message-ID: | 20120730161416.GB10877@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Mon, Jul 30, 2012 at 05:56:22PM +0200, Andres Freund wrote:
> Hi,
>
> On Monday, July 30, 2012 05:38:07 PM Anderson Valadares wrote:
> > I understand, but the memory should not be returned after the execution of
> > the function?
> Well, that depends on how memory was allocated by the libc. When it used brk()
> to allocate memory its rather likely that the memory cannot directly be
> returned because some block of memory in the new memory is still used by some
> permanent memory context.
>
> > Below is the result of running with more than 55,000 calls.
> >
> > PID USER PR NI VIRT SWAP RES CODE DATA SHR S P %CPU %MEM TIME+
> > COMMAND
> > 618 postgres 15 0 1687m 1.2g 507m 4684 505m 3796 S 1 0.0 4.2 0:04.90
> > postgres: postgres test [local] idle
> Interesting. I just let the thing run - by accident - for 30+ minutes and it
> still hovered at 96MB.
FYI, I did a blog entry that mentions when memory is returned:
http://momjian.us/main/blogs/pgblog/2012.html#February_1_2012
Specifically, only single memory allocations greater than MMAP_THRESHOLD
are returned to the operating system.
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ It's impossible for everything to be true. +
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2012-07-30 16:21:38 | Re: BUG #6774: FOR IN SELECT LOOP ignores ORDER BY |
Previous Message | Andres Freund | 2012-07-30 15:56:22 | Re: BUG #6785: Memory Leak in plpgsql |