自己写的小游戏,运行到一半,提示会导致微信响应变慢而被终止,然后就退出了,有时候是微信闪退。
不知道是什么原因,看代码没有什么问题,就是用context.drawimage方法,在每一帧里面绘图,没有内存泄漏。
遇到这种问题不知道去定位问题,如何修复问题?
这个数组超了吗?如果超了,有什么办法吗?感觉问题不大啊。
this.shapesData = new Array()
this.shapesData[0] = [
{
width: 2,
height: 2,
matrix: [{
x:0,
y:0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
}
]
this.shapesData[1] = [
{
width: 4,
height: 1,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 0,
y: 3
}]
},
{
width: 1,
height: 4,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 2,
y: 0
},
{
x: 3,
y: 0
}]
},
{
width: 4,
height: 1,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 0,
y: 3
}]
},
{
width: 1,
height: 4,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 2,
y: 0
},
{
x: 3,
y: 0
}]
}
]
this.shapesData[2] = [
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 1
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 0
}]
},
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 1
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 0
}]
}
]
this.shapesData[3] = [
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 2,
y: 0
}]
},
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 1
},
{
x: 1,
y: 1
},
{
x: 2,
y: 1
},
{
x: 2,
y: 0
}]
}
]
this.shapesData[4] = [
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 2
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 2,
y: 0
},
{
x: 2,
y: 1
}]
},
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 1,
y: 0
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 1,
y: 1
},
{
x: 2,
y: 1
}]
}
]
this.shapesData[5] = [
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 1
}]
},
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 1
}]
}
]
this.shapesData[6] = [
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 1,
y: 2
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 0
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 0
}]
},
{
width: 3,
height: 2,
matrix: [{
x: 0,
y: 0
},
{
x: 0,
y: 1
},
{
x: 0,
y: 2
},
{
x: 1,
y: 1
}]
},
{
width: 2,
height: 3,
matrix: [{
x: 0,
y: 1
},
{
x: 1,
y: 0
},
{
x: 1,
y: 1
},
{
x: 2,
y: 1
}]
}
]