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

fix mac os memory leak #33

Merged
merged 13 commits into from
Oct 21, 2021
Merged

fix mac os memory leak #33

merged 13 commits into from
Oct 21, 2021

Commits on Jul 28, 2021

  1. fix mac os memory leak

    TLDR;
    I did not find an easy way to clean up NSArray, but there is a better option to get NSString from pasteboard - stringForType.
    
    Next up. Even if send release to NSString, there are leftovers after conversion NSString to Rust string. Right now, conversion happens in INSString.as_str(), which internally uses NSString.UTF8String. UTF8String, according to Apple docs, is a pointer lifetime of which is less or equal NSString. This is not true if the clipboard contains characters outside the ASCII range. That's why nsstring_to_rust_string function.
    
    I tried to describe the full process here https://barhamon.com/post/rust_and_nsstring
    Sergey Bargamon committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    d828189 View commit details
    Browse the repository at this point in the history
  2. cargo fmt

    Sergey Bargamon committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    063c2a8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fba91c2 View commit details
    Browse the repository at this point in the history
  4. Okay. I give up. Installed nightly toolchain

    Sergey Bargamon committed Jul 28, 2021
    Configuration menu
    Copy the full SHA
    09d4d74 View commit details
    Browse the repository at this point in the history

Commits on Oct 2, 2021

  1. get rid of libc

    This should be done at rust_objc_fondation.
    Updating original pull request, just in case it need to be fixed right now
    Sergey Bargamon committed Oct 2, 2021
    Configuration menu
    Copy the full SHA
    ca814d3 View commit details
    Browse the repository at this point in the history
  2. remove libc from dependencies

    Sergey Bargamon committed Oct 2, 2021
    Configuration menu
    Copy the full SHA
    f94e57d View commit details
    Browse the repository at this point in the history
  3. make nightly fmt happy

    Sergey Bargamon committed Oct 2, 2021
    Configuration menu
    Copy the full SHA
    120a014 View commit details
    Browse the repository at this point in the history

Commits on Oct 12, 2021

  1. wrap NSString we got from pasteboard into objc_id::Id

    Since we get our string from pasteboard, we need to inform objc runtime that we finished using it. We can do it by ourselves by sending the release message or use Id::from_retained_ptr, and Id will release that NSString when it goes out of scope.
    Sergey Bargamon committed Oct 12, 2021
    Configuration menu
    Copy the full SHA
    740055c View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2021

  1. get rid of memory leak with autoreleasepool

    Sergey Bargamon committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    5923b2a View commit details
    Browse the repository at this point in the history

Commits on Oct 17, 2021

  1. revert unnecessary changes

    Sergey Bargamon committed Oct 17, 2021
    Configuration menu
    Copy the full SHA
    314e4a2 View commit details
    Browse the repository at this point in the history

Commits on Oct 19, 2021

  1. remove unnecessary whitespace

    Sergey Bargamon committed Oct 19, 2021
    Configuration menu
    Copy the full SHA
    bb033c6 View commit details
    Browse the repository at this point in the history
  2. make nightly fmt happy

    Sergey Bargamon committed Oct 19, 2021
    Configuration menu
    Copy the full SHA
    1558d31 View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2021

  1. put use crate::common::*; back

    Sergey Bargamon committed Oct 20, 2021
    Configuration menu
    Copy the full SHA
    34c0d76 View commit details
    Browse the repository at this point in the history