geometric memory growth
Ulf Wiger
ulf@REDACTED
Sun Dec 4 09:12:18 CET 2005
Den 2005-12-03 23:30:50 skrev Ulf Wiger <ulf@REDACTED>:
> Den 2005-12-03 13:31:44 skrev Thomas Lindgren <thomasl_erlang@REDACTED>:
>
>> --- "Ulf Wiger (AL/EAB)" <ulf.wiger@REDACTED>
>> wrote:
>>
>>> To boot, the "bug" was very difficult to spot, /.../
>>
>> Maybe there should be some way to determine the "size"
>> of a closure and the amount of memory copied when a
>> message is passed (e.g., in the process info)?
>
> There is: erts_debug:size/1.
>
> To my knowledge, it isn't documented.
There is also an erts_debug:flat_size/1.
Of course, the way to pin-point that you're in
trouble in the first place would be to run a
GC trace on all processes and watch the heap
size indicator in the trace messages.
Once a process has been identified that gets
very large heaps, you can combine with either
call trace (and perhaps call return trace), to
see in which function the process happens to be
when the gc kicks in - or, in this case, message
trace, and spot the messages with funs in them.
Of course, you won't be able to see that the funs
are large just by looking at the message, but you
can then instrument the code by inserting calls
to erts_debug:size(Fun).
The way to watch it in a live system would be
erlang:system_monitor(MonPid, [{large_heap,Sz}|...])
/Uffe
--
Ulf Wiger
More information about the erlang-questions
mailing list