You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
steveklabnik opened this issue
Dec 20, 2017
· 2 comments
Labels
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-mediumMedium priority
... it is strongly recommended that you only free memory allocated by a Vec by creating a new Vec and dropping it.
Could someone parse this for me? To me, it reads like "to free memory allocated by a Vec v, create a new Vec w and drop it (i.e., w)".
This is obviously not what it is intended. What's the role of the second Vec? Is this only in a context where v is empty but its memory not yet freed? If so, why wouldn't shrink_to_fit work in that case?
The text was updated successfully, but these errors were encountered:
steveklabnik
added
E-easy
Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
P-medium
Medium priority
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
labels
Dec 20, 2017
This refers to unsafe code that e.g. uses Vec::with_capacity to allocate memory, and then mem::forgets the Vec to use the buffer in different ways (e.g., passing it to C, or implement a custom data structure over the allocated memory).
A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsE-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.P-mediumMedium priority
Originally reported here: https://news.ycombinator.com/item?id=15969317
I don't understand the following sentence:
Could someone parse this for me? To me, it reads like "to free memory allocated by a Vec v, create a new Vec w and drop it (i.e., w)".
This is obviously not what it is intended. What's the role of the second Vec? Is this only in a context where v is empty but its memory not yet freed? If so, why wouldn't shrink_to_fit work in that case?
The text was updated successfully, but these errors were encountered: