0

my code is like this:


#include \<stdio.h\>
\#include "ipp.h"

int main(){
int specSize = 0, bufferSize = 0, specBufferSize = 0;
int order = 12;
IppStatus status = ippsFFTGetSize_C_64fc(order,IPP_FFT_DIV_INV_BY_N,ippAlgHintNone,&specSize,&specBufferSize,&bufferSize);

    IppsFFTSpec_C_64fc* spec = (IppsFFTSpec_C_64fc*)ippsMalloc_64fc(specSize);
    Ipp8u* pSpecBuffer = (Ipp8u*)ippsMalloc_8u(specBufferSize);
    Ipp8u* pBuffer = (Ipp8u*)ippsMalloc_8u(bufferSize);
    
    status = ippsFFTInit_C_64fc(&spec,order,IPP_FFT_DIV_INV_BY_N,ippAlgHintNone,pSpecBuffer,pBuffer);
    
    ippsFree(spec);
    ippsFree(pSpecBuffer);
    ippsFree(pBuffer);

}

The return result of ippsFFTInit_C_64fc is normal, which means status==0. However, when it comes to ippsFree, a segmentation fault occurs: \*\*\* Error in './IPPTest': free(): invalid next size (normal): 0x0000000000890630 \*\*\*

How should I fix this?

I found that when order is less than 11, the code works. What's more, if I deleted all ippFree, the code still works even when order is larger than 11. Therefore, I believe that this is not caused by insufficient memory space.

tian yu
  • 11
  • 2
  • Hi- I notice a few problems: you shouldn't allocate (or free) spec, also you're passing the wrong buffers to ippsFFTInit_C_64fc(), pSpecBuffer should be sized specSized, pBuffer should be sized specBufferSize, and you should handle the value of status (if it's not zero- so you know if your order is valid). – gremto Jul 04 '23 at 16:17

0 Answers0