[erlang-questions] Question about implementation

Max Lapshin max.lapshin@REDACTED
Mon Sep 10 16:27:20 CEST 2012


For example I have such gen_server:

-record(state,
   field1,
   field2,
   field3,
   counter = 0
}.



handle_info(incr, #state{counter = Counter} = State) ->
   {noreply, State#state{counter = Counter + 1}};


Will here whole #state{} be deep-copied with new Counter +1 field, or
it is possible to guess, that here optimization is possible and just
"edit" counter field in existing tuple?

Is it possible to understand by erlang source code, that State is no
longer referenced anywhere to avod large allocation and free?



More information about the erlang-questions mailing list