Messages in this thread | | | Date | Fri, 31 Mar 2023 09:05:26 +0200 | Subject | Re: [PATCH v3 12/13] rust: sync: reduce stack usage of `UniqueArc::try_new_uninit` | From | Alice Ryhl <> |
| |
On 3/30/23 00:33, y86-dev@protonmail.com wrote: > From: Benno Lossin <y86-dev@protonmail.com> > > `UniqueArc::try_new_uninit` calls `Arc::try_new(MaybeUninit::uninit())`. > This results in the uninitialized memory being placed on the stack, > which may be arbitrarily large due to the generic `T` and thus could > cause a stack overflow for large types. > > Change the implementation to use the pin-init API which enables in-place > initialization. In particular it avoids having to first construct and > then move the uninitialized memory from the stack into the final location. > > Signed-off-by: Benno Lossin <y86-dev@protonmail.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
| |