[erlang-questions] Garbage collecting binaries
Sat Oct 9 09:42:02 CEST 2010
On Sat, Oct 9, 2010 at 3:28 PM, Masklinn <> wrote:
> On 9 oct. 2010, at 00:34, Scott Lystig Fritchie <> wrote:
>> Tom, one other thing to keep in mind ... if you pull in a huge binary,
>> and then use pattern matching to "pick apart" that binary, the pattern
>> matching is likely to create sub-binaries that still reference the
>> original. So then the chain of who's got a reference to the huge binary
>> gets more difficult to untangle: if you keep the small sub-binary around
>> forever (e.g. as part of a long-lived process's state), then you'll keep
>> the underlying "heap" binary around forever also.
> On that subject, is there any way to force Erlang to copy the binary chunk in order to free it from its dependency on the bigger binary, trading a bit of CPU now for a lit of memory soon?
More information about the erlang-questions