[erlang-questions] process and closure memory usage

Matt Handler matt.handler@REDACTED
Wed Mar 18 22:32:46 CET 2009


I'm trying to cut down on the process memory usage for a non-relational
database i'm working on.  essentially there are 10,000 processes (setup as
gen_servers) that send information to each other in various ways.  i have
several questions:

   1. how much of an overhead does using the gen_server model assert?  if
   i'm not as worried about dynamic code loading, supervising, etc... am i
   wasting memory and processing using the gen_server?
   2. how/where can i find out more information about the memory usage of a
   process?  i've used process_info/2 heavily to gather some of this
   information, but my problem is that if i look at the rough size of the state
   of a process (using erlang:iolist_size/1), it's significantly less than the
   size of the process as reported by process_info/2.  i want to know where the
   rest of the memory is being eaten up (initially the processes are only 1k),
   on average, the process size is about 4x the state size.
   3. i am passing around many closures between the nodes of the database,
   and they are getting to be quite large (start out as 100bytes, end up as
   40kbytes).  these are what is taking up most of the memory of the state, and
   so i'm wondering if there is some inner workings of the erlang system that
   make this a bad way of programming in terms of memory usage.  it seems like
   there are certain situations that make closures take up a lot of memory, but
   i'm having trouble pinpointing when.
   4. is there a good tool out there for profiling the memory usage rather
   than executiontime usage?

thanks for the help,
-matt handler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090318/8cf3f051/attachment.htm>


More information about the erlang-questions mailing list