0715

Create a push behavior with a certain magnitude and angle. And look what I've got. Set the push behavior's action to be, remove this push behavior from the dynamic animator. Since its instantaneous, see how its mode is instantaneous? This is fine. I want this thing removed. I don't want it setting around there collecting dust because it's not going to fire ever again. It fired, the action method got called, I put this closure method in here to do this.

But of course this has a memory cycle, a really bad one. Because this push behavior has a var action which is a closure. So it has a strong pointer to this closure. Push behavior's action is a strong pointer to this closure. And this closure references the push behavior, ?so it has a strong pointer back to the push behavior. So this will happen just fine and now the only people pointing to this push behavior, since it got removed from the dynamic animator, the only thing pointing to it is this closure. And it's pointing to closure, so they're keeping each other in the heep. So this is our classic memory cycle.

And just to remind how we break it here. We are just going to put unowned push behavior in here. Cuz we know that this can never be out of the heep when action is called by definition.

Action is only called when his push behavior does anything. So it has to clearly still be in the heep done anything .

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子蹄皱,更是在濱河造成了極大的恐慌摇天,老刑警劉巖系任,帶你破解...
    沈念sama閱讀 217,509評論 6 504
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件遮糖,死亡現(xiàn)場離奇詭異,居然都是意外死亡高氮,警方通過查閱死者的電腦和手機孽亲,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,806評論 3 394
  • 文/潘曉璐 我一進店門坎穿,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人返劲,你說我怎么就攤上這事玲昧。” “怎么了篮绿?”我有些...
    開封第一講書人閱讀 163,875評論 0 354
  • 文/不壞的土叔 我叫張陵孵延,是天一觀的道長。 經(jīng)常有香客問我亲配,道長尘应,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 58,441評論 1 293
  • 正文 為了忘掉前任弃榨,我火速辦了婚禮菩收,結果婚禮上,老公的妹妹穿的比我還像新娘鲸睛。我一直安慰自己,他們只是感情好坡贺,可當我...
    茶點故事閱讀 67,488評論 6 392
  • 文/花漫 我一把揭開白布官辈。 她就那樣靜靜地躺著箱舞,像睡著了一般。 火紅的嫁衣襯著肌膚如雪拳亿。 梳的紋絲不亂的頭發(fā)上晴股,一...
    開封第一講書人閱讀 51,365評論 1 302
  • 那天,我揣著相機與錄音肺魁,去河邊找鬼电湘。 笑死,一個胖子當著我的面吹牛鹅经,可吹牛的內容都是我干的寂呛。 我是一名探鬼主播,決...
    沈念sama閱讀 40,190評論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼瘾晃,長吁一口氣:“原來是場噩夢啊……” “哼贷痪!你這毒婦竟也來了?” 一聲冷哼從身側響起蹦误,我...
    開封第一講書人閱讀 39,062評論 0 276
  • 序言:老撾萬榮一對情侶失蹤劫拢,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后强胰,有當?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體舱沧,經(jīng)...
    沈念sama閱讀 45,500評論 1 314
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 37,706評論 3 335
  • 正文 我和宋清朗相戀三年偶洋,在試婚紗的時候發(fā)現(xiàn)自己被綠了狗唉。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 39,834評論 1 347
  • 序言:一個原本活蹦亂跳的男人離奇死亡涡真,死狀恐怖分俯,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情哆料,我是刑警寧澤缸剪,帶...
    沈念sama閱讀 35,559評論 5 345
  • 正文 年R本政府宣布,位于F島的核電站东亦,受9級特大地震影響杏节,放射性物質發(fā)生泄漏。R本人自食惡果不足惜典阵,卻給世界環(huán)境...
    茶點故事閱讀 41,167評論 3 328
  • 文/蒙蒙 一奋渔、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧壮啊,春花似錦嫉鲸、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,779評論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽座菠。三九已至,卻和暖如春藤树,著一層夾襖步出監(jiān)牢的瞬間浴滴,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,912評論 1 269
  • 我被黑心中介騙來泰國打工岁钓, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留升略,地道東北人。 一個月前我還...
    沈念sama閱讀 47,958評論 2 370
  • 正文 我出身青樓屡限,卻偏偏與公主長得像品嚣,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子囚霸,可洞房花燭夜當晚...
    茶點故事閱讀 44,779評論 2 354

推薦閱讀更多精彩內容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 9,495評論 0 23
  • 透明的人流激起的塵埃 舞動了一段飄逸的節(jié)奏 隨后腰根,靜默一場疲憊的旅程 在雕塑的依附里 結束一場驚艷的迷途 如一場少...
    覺夢2016閱讀 201評論 0 2
  • 上面是原始文本,下面是對應Markdown效果,整理出來,方便查閱. A First Level Header A...
    dreamkong閱讀 277評論 0 2
  • 1.1 Android WebView 一些基本概念 開發(fā)過程中應該注意:1.AndroidManifest.xm...
    六便士少年閱讀 2,002評論 2 12