0715

作者: 涂画 | 来源:发表于2016-07-18 20:18 被阅读17次

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 .

相关文章

  • 【徐老大塔羅馬雅週報0715~0721】

    【徐老大塔羅馬雅週報0715~0721】 「轉變之週」:本週信任自身的力量,適時表達,踏上轉變之境。 0715力量...

  • 0715

    今天休息日。 明天开始迎接新的一周。 希望明天更努力一些。

  • 0715

  • 0715

    你永远也看不到我最寂寞时候的样子,因为只有你不在我身边的时候,我才最寂寞。

  • 0715

    嗯...看到你第一句问我谁拍的照片我还是很高兴。有什么意味吗

  • 0715

    今天朋友圈充满了晒云晒天空,我也给你晒晒。 第八章好难,只好先大致看一遍,没有很好理解。 要开始准备公务员考试了。...

  • 0715

    連哭都找不到方式

  • 0715

    Create a push behavior with a certain magnitude and angle...

  • 0715

    嗯哼…嗯…昨天从戴戴的生日回来以后也想了很多,花花对戴戴的用心,上次戴戴对花花的用心,好像觉得自己做的也很微不足道...

  • 0715

    如果有一件事,你明明应该去做,却就是不愿意去做,每个人都有这样的状态吧? 33岁,需要遵医嘱减肥,身体让我明白要一...

网友评论

      本文标题:0715

      本文链接:https://www.haomeiwen.com/subject/gkfmjttx.html