我查了所有在我的代碼,並不能找到這崩潰之源: 我試圖解碼與NSKeyedUnarchiver一個對象,它在它的每一次崩潰,並說:Objc內存崩潰與autorelase
*** __NSAutoreleaseFreedObject(): release of previously deallocated object (0x1008ad200) ignored
*** __NSAutoreleaseFreedObject(): release of previously deallocated object (0x1008ab200) ignored
*** __NSAutoreleaseFreedObject(): release of previously deallocated object (0x1008a8c00) ignored
哈我不好意思爲什麼initWithCoder沒有被調用是因爲它有問題[super initWithCoder:];這仍然讓我發瘋。我一看,指針和NSData的對象是什麼走錯了:
vertices = malloc(size_point3D * vertexCount);
textureCoords = malloc(size_point2D * textureCount);
normals = malloc(size_point3D * normalCount);
faces = malloc(sizeof(GLuint) * faceCount);
NSData *vertexData = [[NSData alloc] initWithData:[coder decodeObjectForKey:@"vertices"]];
NSData *textureData = [[NSData alloc] initWithData:[coder decodeObjectForKey:@"textureCoords"]];
NSData *normalData = [[NSData alloc] initWithData:[coder decodeObjectForKey:@"normals"]];
NSData *faceData = [[NSData alloc] initWithData:[coder decodeObjectForKey:@"faces"]];
memcpy(vertices, [vertexData bytes], sizeof(point3D) * vertexCount);
memcpy(textureCoords, [textureData bytes], sizeof(point2D) * textureCount);
memcpy(normals, [normalData bytes], sizeof(point3D) * normalCount);
memcpy(faces, [faceData bytes], sizeof(GLuint) * faceCount);
[vertexData release];
[textureData release];
[normalData release];
[faceData release];
我試圖保留這部分(甚至是字符串)的一切,但它並不能幫助。
你可以張貼一些代碼? – 2010-09-06 03:56:21
嗯,但它是一個非常深的堆棧 – 2010-09-06 04:05:47
它看起來像你正在重新定義模型。路徑是伊娃嗎?我認爲步驟1將確切地找出哪個對象試圖獲得兩次釋放。有點棘手,只有很少的代碼可以繼續。 – taber 2010-09-06 04:39:53