binary:copy before sending message, or after receiving it?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

binary:copy before sending message, or after receiving it?

Roger Lipscombe-2
I've got a piece of code that's run from a long-lived, but not
particularly memory-heavy process. It looks like this:

    JSON = jiffy:encode(SomeMap),
    gen_server:cast(Server, {append, JSON}).

I suspect that this is causing a bunch of fragmentation of the binary
heap. Should I be calling binary:copy(JSON) before I send the message,
in this process? Or should I be calling binary:copy in the receiving
gen_server? Or doesn't it matter, as long as one of them does it?
_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions