Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Section 15.6 title is maybe a little misleading #575

Closed
icefoxen opened this issue Mar 28, 2017 · 4 comments
Closed

Section 15.6 title is maybe a little misleading #575

icefoxen opened this issue Mar 28, 2017 · 4 comments
Labels
Milestone

Comments

@icefoxen
Copy link

The title for section 15.6 is "Creating Reference Cycles and Leaking Memory is Safe". At a glance this could imply that Rust magically cleans up after you somehow, which might be deceptive to new people (even though you explain exactly what you mean in the first paragraph after that title). An alternative might be to just say "Creating Reference Cycles and Leaking Memory is Not Unsafe".

It might also be worth saying that, while Rust doesn't guarantee lack of memory leaks, under most circumstances the only way it will happen is if you create cycles through refcounted pointer types. Just saying "preventing memory leaks is not one of Rust's guarantees" leaves open the possibility that safe code which does not create refcount cycles still could leak memory, which as far as I know should never happen.

@carols10cents
Copy link
Member

What about "Creating Reference Cycles Can Leak Memory"?

@icefoxen
Copy link
Author

That seems reasonable. I feel like there should still be some mention of memory safety involved, since that's one of Rust's big concerns, but maybe I'm trying to pack too much information into a section heading...

@carols10cents
Copy link
Member

I do like the pithy saying "memory leaks are memory safe", but I think I worked that into the text, which is probably a better place, as you're saying.

Would you like to send in a PR or would you like me to take care of this? Either is fine with me! ❤️

@nodakai
Copy link
Contributor

nodakai commented Apr 7, 2017

@icefoxen

Just saying "preventing memory leaks is not one of Rust's guarantees" leaves open the possibility that safe code which does not create refcount cycles still could leak memory, which as far as I know should never happen.

You know what...

Nowadays more and more people are accepting to use the term "memory leak" to mean carelessly making objects' lifetime too long. As rustc will not warn you "Hey you shouldn't push this object to the static Vec, you gotta drop it quickly," I'd be very careful with making statements like "Rust can leak memory only though reference cycles or unsafe code" not to make exaggerations.

@carols10cents How about "Reference Cycles Can Leak Memory" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants