LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Memory overlap problem. using IPP(intel performance libraries)

I try to using IPP in 'Natinal Instruments - LabWindows/CVI'.

 

Code compile is no problem..

 

But..I get the error on application runtime.

 

Error is a memory free.

 

I allocate my local mem, IPP's mem.

 

and I free ipp's mem.

 

Accordingly my local mem is freed..

 

I guess that IPP's allocate mem overlaped to my locall mem..

 

See my code sample..

 

///////////////////////////////////////////////////////////

#define MAX_LEN 262144*16

 

static double *buffer;

 

void main(void)

{

    .

    .

    buffer = malloc(sizeof(double), MAX_LEN);

    .

    .

    .

    while(Flag)

    {

         .

         .

         test();

         .

         .

         memcpy(buffer,  rtData, sizeof(double)*MAX_LEN);

         .

         .

         .

    }

}

 

void test(double *rtData)

{

    .......

    Ipp64f *temp_aver = ippsMalloc_64f( FreqBin );

    .

    .

    .

    ippsFree( temp_aver );

}

/////////////////////////////////////////////////////////////

 

What is the mistake?

0 Kudos
Message 1 of 2
(3,085 Views)

Your sample code does not show full details, but one suspicious area is within test(). You seem to allocate and free some memory in here, so when you return to main() this memory area no longer exists. Yet there is an implication that the memcpy() you use shortly after the call to test() is intended to somehow use the results of this function? This would be illegal and fail at runtime, if you are trying to copy from the area allocated within test(). If I have misread the intent of your code perhaps you could post a bit more detail?

 

JR

0 Kudos
Message 2 of 2
(3,081 Views)