我在更新方法中添加了 CCLabel 以显示我的游戏分数。
它在分数提高到 5000 之前运行良好。之后 logCat 显示消息:
02-08 11:47:37.476: E/dalvikvm-heap(4190): 1048576-byte external allocation too large for this process.
02-08 11:47:37.476: E/dalvikvm(4190): Out of memory: Heap Size=14343KB, Allocated=13585KB, Bitmap Size=2078KB
java.lang.reflect.InvocationTargetException......
caused by java.lang.OutOfMemoryError
我的代码是:
countScore++ ;
Log.e("total Score:", "" + countScore);
CCLabel labelScore = CCLabel.makeLabel("" + countScore, "DroidSans", 20);
labelScore.setColor(new ccColor3B(1,1,1));
labelScore.setPosition(CGPoint.ccp(50, 50));
addChild(labelScore, 11);
labelScore.setTag(11);
_labelScores.add(labelScore);
CCCallFuncN actionMoveDone1 = CCCallFuncN.action(this, "labelFinished");
CCSequence action = CCSequence.actions(actionMoveDone1);
labelScore.runAction(action);
如何解决?