-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
docs: add sway memory model #6775
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sdankel
reviewed
Dec 5, 2024
Co-authored-by: Sophie Dankel <[email protected]>
bitzoic
reviewed
Dec 6, 2024
IGI-111
reviewed
Dec 6, 2024
sdankel
approved these changes
Dec 9, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Snapshot has been taken
13 Ara 2024 Cum 16:13 tarihinde Matt ***@***.***> şunu yazdı:
… ***@***.**** commented on this pull request.
------------------------------
In docs/book/src/reference/rust_differences.md
<#6775 (comment)>:
> @@ -34,3 +34,9 @@ struct MyStruct {
field_two: bool,
}
```
+
+## Memory Allocation
+
+In Rust, the borrow checker implements Rust's [ownership system](https://doc.rust-lang.org/1.8.0/book/ownership.html)
+
+In Sway, there is no borrow checker. This means there is no concept of ownership, borrowing, or lifetimes. Instead, objects are copied and moved similar to C++. Also Sway does not have any destructors nor `Drop` traits. This means allocated memory lives for the entire transaction and is not deallocated until the end of the transaction. A transaction can contain 65 MB of memory.
I couldn't find it in the specs, but I linked to where it is in our code
—
Reply to this email directly, view it on GitHub
<#6775 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATO66TZ37AEWLZLRM3MGLOT2FLMNXAVCNFSM6AAAAABTC6GS5WVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKMBSGI3DSMRVG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
xunilrj
approved these changes
Dec 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Developers get confused by Sway's memory model as it is different from Rust's. So I added this to the docs.
closes https://app.asana.com/0/1207924201336629/1208429018056446
Checklist
Breaking*
orNew Feature
labels where relevant.