所以,我的代码的调试版本有效,但发行版无效

时间:2021-01-26 21:22:37

标签: visual-studio debugging malloc release

就像标题所说的那样,我的代码的调试版本有效,但发布时没有,它只是退出程序而不做任何事情,如果我将其置于发布模式并使用调试,我会在以下位置抛出异常未处理的异常codec.exe 中的 0x00007FF6DA208CB0:0xC0000005:访问冲突读取位置 0x0000000000000008。 和一个大屏幕说符号文件未加载,在我的程序中我使用 malloc,因为我需要一个可变大小的数组,这可能是问题吗?,在调试模式下,我有一个名为取消引用空指针的警告,在我使用的指针处内存分配 //这里有一些code

        for (int j = 0; j < animation->servoTableSize.cols; j++)
    {
        // Analyze pixel change
        uint8_t* LocalMaximums = (uint8_t*)malloc((animation->servoFrameCount) * sizeof(uint8_t));
        //^^^ remembers the frames in which local maximums are
        int NumberOfSpikes = 0;
        //^^^remembers how many spikes there are


        //here we search for local spikes (local maximums)
        for (int FrameNumber = 0; FrameNumber < animation->servoFrameCount; FrameNumber++)
        {
            if (FrameNumber == 0
                && animation->servos[FrameNumber]->data[i][j] >= animation->servos[FrameNumber + 1]->data[i][j])
                //^^^if it's the first frame AND current value is higher or equal to the next value, then we have a new spike
                //we put the spike's frame in "Local Maximums",and increase the number of spikes
            {
                LocalMaximums[NumberOfSpikes] = FrameNumber;
                NumberOfSpikes++;
            }

0 个答案:

没有答案
相关问题