How does the garbage collector really works?

Bjorn Gustavsson bjorn@REDACTED
Wed May 17 14:02:11 CEST 2000

An alternate way to get rid of garbage is to spawn a new separate
process for temporary jobs. Terminating a process frees all its memory
at once, faster than a garbage collection would do.


"Jonas Jerfsten" <jonas.jerfsten@REDACTED> writes:

> Hi!
> 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,

Björn Gustavsson            Ericsson Utvecklings AB
bjorn@REDACTED      ÄT2/UAB/F/P
			    BOX 1505
+46 8 727 56 87 	    125 25 Älvsjö

More information about the erlang-questions mailing list