Skip to content

Break retain cycles and fix memory leaks#224

Open
5sw wants to merge 11 commits into
rowanj:masterfrom
5sw:memory
Open

Break retain cycles and fix memory leaks#224
5sw wants to merge 11 commits into
rowanj:masterfrom
5sw:memory

Conversation

@5sw

@5sw 5sw commented Jul 13, 2013

Copy link
Copy Markdown

Added __weak and __unsafe_unretained at the appropriate places to break all retain cycles. So finally the git repository gets dealloced when the window is closed.

@tiennou

tiennou commented Jul 13, 2013

Copy link
Copy Markdown

Please note that __weak isn't compatible with some classes on 10.7 (see #208 for an example). So if you're reverting anything touched by 5a9bf26, that won't fly for 10.7 users ;-).

Just taking a quick look at the diff, it seems like this ought to be fine tough.

@5sw

5sw commented Jul 13, 2013

Copy link
Copy Markdown
Author

Sure. I was careful to use __unsafe_unretained instead of __weak for NSViewControllersubclasses. Still no guarantees that I didn’t miss some as I don‘t have 10.7 available for testing.

@rowanj

rowanj commented Aug 5, 2013

Copy link
Copy Markdown
Owner

Can anyone verify on 10.7?

@5sw

5sw commented Jul 13, 2014

Copy link
Copy Markdown
Author

Is 10.7 still relevant? Seems nobody here is using that anymore to test this.

It is still very important to break those retain cycles so things get properly released. Not just because of memory.

  • Open a git repository in gitx
  • Close the repo again, but leave gitx running
  • Move the whole repository to the trash
  • Try to empty trash

Doesn't work as some pack-index-files are still open.

@rowanj

rowanj commented Jul 17, 2014

Copy link
Copy Markdown
Owner

10.7 and 10.8 each have roughly half the market share of 10.9; so dropping 10.7 is potentially 25% of users capable of running the current version.

Weather that is relevant is debatable, but given the voracity with which bugs are reported when compatibility is broken, I'm leaning toward yes - however I have long said that 10.7 support in GitX won't be around forever unless somebody actually volunteers to maintain it.

The time is coming, I think it may be basically after the next round of bug fixes.

Conflicts:
	Classes/git/PBGitRepository.m
@rowanj

rowanj commented Jul 27, 2014

Copy link
Copy Markdown
Owner

I should note: I like these changes.

ssp pushed a commit to ssp/gitx-legacy that referenced this pull request May 23, 2021
Fix exception when dragging files in the unstaged and staged changes table views
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.

3 participants