Commit 860980dd by xiaotong

bug of empty head of the first block

parent 6488962c
...@@ -532,7 +532,7 @@ release a piece of memory ...@@ -532,7 +532,7 @@ release a piece of memory
*/ */
void XMem::Release(void * p, MTYPE size, MTYPE code) void XMem::Release(void * p, MTYPE size, MTYPE code)
{ {
//if(code == signature) if(code == signature)
Release(devID, p, size); Release(devID, p, size);
} }
...@@ -931,7 +931,7 @@ void XMem::RebuildIndex() ...@@ -931,7 +931,7 @@ void XMem::RebuildIndex()
for(int bi = 0; bi <= curBlockID; bi++){ for(int bi = 0; bi <= curBlockID; bi++){
XMemBlock * block = blocks + bi; XMemBlock * block = blocks + bi;
if(block->mem == NULL) if(block->mem == NULL || block->head == NULL)
continue; continue;
MHeader * head = block->head; MHeader * head = block->head;
...@@ -982,7 +982,7 @@ void XMem::RebuildIndex() ...@@ -982,7 +982,7 @@ void XMem::RebuildIndex()
MPieceNode * newNode = memIndex2 + nodeNumUsed2++; MPieceNode * newNode = memIndex2 + nodeNumUsed2++;
newNode->p = p; newNode->p = p;
newNode->size = (char*)p + head->size - newNode->size = (char*)p + head->size -
( head->state == 1 ? (char*)GetPitchedAddress((char*)p, MY_PITCH) : head->indexNode->pReal); ( head->state == 1 ? (char*)GetPitchedAddress((char*)p, MY_PITCH) : (char*)head->indexNode->pReal);
newNode->pre = NULL; newNode->pre = NULL;
newNode->next = NULL; newNode->next = NULL;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论