Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea63430

Browse files
committed
Fix memory leak in Tree implementation
- caused by retain cycle between parent and child (parent has a strong reference to child, and child has a strong reference to parent)
1 parent4daa519 commitea63430

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎Tree/Tree.playground/Contents.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
publicclassTreeNode<T>{
44
publicvarvalue:T
55

6-
publicvarparent:TreeNode?
6+
publicweakvarparent:TreeNode?
77
publicvarchildren=[TreeNode<T>]()
88

99
publicinit(value:T){

‎Tree/Tree.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
publicclassTreeNode<T>{
22
publicvarvalue:T
33

4-
publicvarparent:TreeNode?
4+
publicweakvarparent:TreeNode?
55
publicvarchildren=[TreeNode<T>]()
66

77
publicinit(value:T){

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp