"_CrtIsValidHeapPointerUserData means, that you have a heap corruption, which is noticed by debug heap checker. Suspect everybody who can write any information into any deleted dynamic object".
_CrtIsValidHeapPointerUserData 意味着堆崩溃。
假设有语句char* p = new char[256];
delete[]p;
delete时发生上述中断,最好仔细检查在程序的中途是否改变了p指针的指向。
我的语句是这样写的:
Protein_Index_Table *pro_idx_table = new Protein_Index_Table[max_idxTable_size]; //index datda delete[]pro_idx_table;
发生异常的时候,我以为是由于结构体的原因,可能不能对结构体变量使用new和delete,查阅msdn delete没有发现说delete不能用于结构体,
仔细检查,发现自己误写了一句:
pro_idx_table[pro_idx_table_len].AC_Pos = ftell(ac_fp); pro_idx_table[pro_idx_table_len].DE_Pos = ftell(de_fp); pro_idx_table[pro_idx_table_len].SQ_Pos = ftell(sq_fp); fwrite(pro_idx_table + pro_idx_table_len, sizeof(Protein_Index_Table), 1, index_fp); pro_idx_table++;
pro_idx_table++应该是pro_idx_table_len++.