How does the garbage collector really works?

Jonas Jerfsten jonas.jerfsten@REDACTED
Tue May 16 21:48:55 CEST 2000

I have a question about how the garbage collector (gc) in Erlang works. I am
working on a module that performs a file:consult/1 on a large file and then
stores the data in an ets-table. All that is done in the init of the
process. I have performed memory analysis on the process using
erlang:trace/3 and process_info/2. It seems as if the file:consult/1
function call results in a large memory allocation and that the process will
hold on to that memory even after the calling function has gone out of
scope. If I do not make any further function calls to the process, it seems
as if the gc will not go in and free the memory. That means that when the
process is initialised, it will allocate a lot of memory and keep it until
the process is scheduled again. Correct? Or am I making incorrect
assumptions from my memory analysis? If the process is not scheduled again,
when will the gc free the memory?

/Jonas Jerfsten

Sjöland & Thyselius AB
Address: Sehlstedtsgatan 6, S-115 28 STOCKHOLM
Phone:+46(0)8-587 623 04 Mobil: +46(0)708-12 33 36 Fax: +46(0)8-667 82 30
Internet: jonas.jerfsten@REDACTED,

More information about the erlang-questions mailing list