[erlang-questions] VM leaking memory

Michael Truog mjtruog@REDACTED
Wed Feb 6 16:50:06 CET 2019

On 2/6/19 2:53 AM, Frank Muller wrote:
> Hello Michael and Fred
> Combing both solutions gave the best result. No need to even touch the 
> memory allocators at all and the system look stable for the last days.
> Michael: I’m passing a sub_binary to the child process created with 
> your sync_fun/2. Is it still a good idea to call binary:copy/1 on this 
> sub_bin inside the Fun? I think it’s useless because this process is 
> garbage collected ASAP anyway.

It isn't necessary.  It should be better and simpler to only create a 
sub_binary inside the temporary process, but it may depend on your 
situation.  The reference counting will ensure all the binaries you need 
after the temporary process is done are kept and you don't need to do 
anything special for that to happen (only keep all the temporary 
binaries inside the temporary process).

Best Regards,

More information about the erlang-questions mailing list