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

Remove drop reference #140

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Remove drop reference #140

merged 1 commit into from
Sep 13, 2023

Conversation

davidbrochart
Copy link
Collaborator

The drop(self) issues a warning:

warning: calls to `std::mem::drop` with a reference instead of an owned value does nothing
   --> src/y_transaction.rs:263:9
    |
263 |         drop(self);
    |         ^^^^^----^
    |              |
    |              argument has type `&mut YTransaction`
    |
    = note: use `let _ = ...` to ignore the expression or result
    = note: `#[warn(dropping_references)]` on by default

@davidbrochart
Copy link
Collaborator Author

I also tested the change with the following code, which doesn't seem to create any memory leak:

from y_py import YDoc

doc = YDoc()
text = doc.get_text("name")
t = "hello"
n = len(t)

while True:
    with doc.begin_transaction() as txn:
        text.insert(txn, 0, t)

    with doc.begin_transaction() as txn:
        text.delete_range(txn, 0, n)

@davidbrochart davidbrochart merged commit c0f3510 into y-crdt:main Sep 13, 2023
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant