CCObject、ref、Director、Autorelease、PoolManager、scene渲染树 cocos2dx两个版本内存管理分析,实现程序员的版本迭代。
所以每次执行完clear,Manager中除了渲染树和_referenceCount>1都会被清理掉;可是pool被清理之后_referenceCount>=1的内存就如渲染树般泄露了,这个时候就需要我用自己release(delete)了。为什么会出现这样子的情况呢,实际上源于早前兼容ObjectC的代码继承过来的管理机制,可能之后Po...
分类:
其他好文 时间:
2014-10-06 19:13:10
阅读次数:
326
CCTargetedTouchDelegate 的继承 和 dynamic_cast想写个可以响应touch的sprite类定义成了这个样子:[cpp]view plaincopyclassGemBoard:publicCCSprite,CCTargetedTouchDelegate然后注册touc...
分类:
其他好文 时间:
2014-10-05 12:21:38
阅读次数:
140
给定一个链表,确定它是否有一个环,不使用额外的空间?...
分类:
其他好文 时间:
2014-10-04 16:08:26
阅读次数:
151
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycl...
分类:
其他好文 时间:
2014-10-04 15:09:06
阅读次数:
187
The Utopian tree goes through 2 cycles of growth every year. The first growth cycle occurs during the monsoon, when it doubles in height. ...
分类:
编程语言 时间:
2014-10-04 14:20:56
阅读次数:
238
一.set方法内存管理当一个对象拥有另一个对象的属性时,需要在set方法对当前所拥有的对象做retain操作,因为你的属性是指向了另一个对象,需要让另一个对象知道有单元在使用我。但是这样写的话不够完善,会出现新的问题。如果对象属性之前已经指向了某一个对象了,此时再传进来一个新的对象,属性指针就指向了...
分类:
其他好文 时间:
2014-10-04 11:53:46
阅读次数:
262
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
这个题目用快慢指针来做,重点在于代码怎么实现的简洁方便理解。
这里用快指针来判断链表是不是有NULL,没有NULL那再继续走,看是否能与慢指针遇上...
分类:
其他好文 时间:
2014-10-01 10:16:10
阅读次数:
309
在模拟器上调试时,经常遇到内存访问错误,如下:2012-02-14 11:21:11.41 App[2433:205] *** -[Test retain]: message sent to deallocated instance 0x11e4fb1.在设置了MallocStackLogging之...
分类:
其他好文 时间:
2014-10-01 03:41:00
阅读次数:
287
【题目】Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?【题意】 推断一个单向链表是否有环【思路】 维护两个指针p1和p2,p1.....
分类:
其他好文 时间:
2014-09-28 21:16:55
阅读次数:
195
多GPU设备处理点积示例,项目打包下载 1 /* 2 * Copyright 1993-2010 NVIDIA Corporation. All rights reserved. 3 * 4 * NVIDIA Corporation and its licensors retain all...
分类:
其他好文 时间:
2014-09-28 20:10:25
阅读次数:
223