1

コード内の行列に割り当てられたメモリを解放しようとすると、問題が発生します。私はこの機能を使用しています:

void free_matrix(float **m, int row)
{
    for( int i=0; i<row; i++ ) 
    {
        free( m[i]);
    }
    free(m);

}

しかし、なぜ機能しないのかわかりません。次のエラーが表示されます。

Windows has triggered a breakpoint in mycode.exe.

This may be due to a corruption of the heap, which indicates a bug in mycode.exe or any of the DLLs it has loaded.

This may also be due to the user pressing F12 while mycode.exe has focus.
4

1 に答える 1

0

ほとんどの場合、割り当てられていないメモリを解放しています。メモリを割り当てたコードを確認するか、投稿して確認してください。有効なポインターでのみ free を呼び出していることを確認してください。また、「新規」と「無料」を間違えないようにしてください。

于 2012-10-08T01:36:48.623 に答える