Closed KillingSpark closed 1 year ago
Because of the dereference operation, the thing passed to mem::forget
is a Shared
without a box around it. This is to avoid running the destructor of fields in the Shared
.
The box allocation is released by the dereference operation.
Hi I was interested in how this crate actually works. While reading the source I stumbled about this piece of code:
https://github.com/tokio-rs/bytes/blob/050d65b2cee8b2272687d798dc209dc03fe92719/src/bytes.rs#L1093
I am pretty sure the
mem::forget
should be amem::drop
so the behaviour matches the comment.forget
causes the Box to never be dropped and thus the allocations will not be released.