On Fri, Nov 22, 2013 at 12:37 PM, Steve Freegard
<st...@stevefreegard.com> wrote:
> Hi,
>
> I'm trying to debug and understand an issue on several of my Haraka servers
> after a recent update.
>
> I'm seeing large amounts of memory being used and never returned back to the
> operating system causing the machine to swap and eventually the Linux OOM
> killer shooting the processes.
>
> I thought that there must be a memory leak somewhere - but I've used
> node-heapdump and taken multiple snapshots and compared them and whilst I'm
> seeing a small growth I'm not seeing anything major.    However the heapdump
> reports the size at ~97Mb whereas the RSS of the process at the time of the
> dump was 1.1Gb which is what I really don't understand at all.
>
> Would such a disparity between heap and RSS indicate that an external C++
> module that is being used is leaking memory??  If so, what is the best way
> of finding out which?
>
> I've tried the mtrace module - but it caused the process to completely hang
> after only a few minutes of running so I had to kill it.   The output that I
> got from it is attached - I'm not really sure it tells me anything though.
>
> Any suggestions as to how to work out what is going on here and how to fix
> it would be gratefully received.
>
> Kind regards,
> Steve.

Tracking down memory leaks in garbage-collected environments is one of
the great unsolved problems of our generation.  Okay, maybe not really
but there is no one-size-fits-all solution.  Here are some things you
can try:

* The mtrace log suggests you're using node.js v0.8.  Consider upgrading.

* Use Valgrind.  Drawback: it's really, really slow and it uses a lot
of memory itself.

* SystemTap.  Write a small stap script that collects malloc/free/etc.
call graphs and aggregates them into histograms.  Strong disparities
between calls to malloc() and free() generally show up quickly that
way.

Apropos that heap snapshot, did you look at the self size or the
retained size?  Buffer objects tend to have small self sizes (usually
on the order of a few hundred bytes) but can have massive retained
sizes.  Note that Buffers in snapshots taken with node.js <= v0.8.11
don't report the true retained size.

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to