Access Violation Using ippsFree

Access Violation Using ippsFree

Hi
I am using IPP 5.0 with VS 2005. I have some memory that I have allocated ippsMalloc_XXX and that i try to free with ippsFree. But when I call ippsFree i get an access violation. Here is some sample code:
struct SignalData
{
Ipp32fc* pos;
Ipp32fc* neg;
};

struct Frame
{
SignalData* data[NUM_BEAMS];
int estCnt;
int coeffCnt;
int corrCnt;
};

Frame* CreateFrame()
{
Frame* f = new Frame();
for(int k=0;k{
f->data[k] = CreateSignalData();
}
f->coeffCnt = 0;
f->corrCnt = 0;
f->estCnt = 0;

return f;
}

void FreeFrame(Frame* f)
{
for(int k=0;k{
FreeSignalData(f->data[k]);
}

delete f;
}

SignalData* CreateSignalData()
{
SignalData* s = new SignalData();
s->neg = ippsMalloc_32fc(SIGNAL_LENGTH);
s->pos = ippsMalloc_32fc(SIGNAL_LENGTH);
return s;
}

void FreeSignalData(SignalData* s)
{
ippsFree(s->neg);
ippsFree(s->pos);
delete s;
}
And its the calls to ippsFree in FreeSignalData that causes the access violation. This happens only wen I run this in debug mode.....
The error messages I get for these to function calls are: First-chance exception at 0x7c926a36 in estimationv1.0.exe: 0xC0000005: Access violation writing location 0xbaadf00d. First-chance exception at 0x7c911e58 in estimationv1.0.exe: 0xC0000005: Access violation reading location 0xbaadf00d.
thank you for any help.

Thor Andreas

Message Edited by thorsan on 04-26-200601:21 AM

Message Edited by thorsan on 04-26-200601:25 AM

5 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Hi!

I have the same problem too. Did you solve it? Or can anyone help? Thx

Bendeguy

I tried it with new and delete operator too and got the same result. I allocate a memory area in the constructor and I write out the pointer values to see if it is changed somewhere. After the allocation my pointer has a value which never changes and when I call the ippsFree or delete[] it throws an acces violation exception. (I call te free because I got a data packet which is larger than my buffer and I want to free it and allocate a new larger one) The WinDbg says the following:

(764.e80): Access violation - code c0000005 (!!! second chance !!!)
eax=1e954798 ebx=15b00000 ecx=00000000 edx=00000000 esi=1e954790 edi=1e94c788
eip=7c910f29 esp=1ea7fd60 ebp=1ea7fd6c iopl=0 nv up ei pl zr na pe nc
cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246
ntdll!RtlpCoalesceFreeBlocks+0x36e:
7c910f29 8b09 mov ecx,dword ptr [ecx] ds:0023:00000000=????????

I hope somebody can help. Greetings,

Bendeguy

Hi,

Most likely that memory which you try to free with ippsFree is corrupted. When ippsMalloc allocate memory it uses few bytes in memory before returned pointer for internal needs. You can check in debugger how these few bytes in memory before for s->neg and s->pos pointers are changed between ippsMalloc and ippsFree calls.

Nikolay

Hi Nikolay!

Thank you for your advice. I've found the source of the problem(I wrote too much data to a buffer which overwrote my pointer's parameter) and I corrected it.

Bendeguy

Login to leave a comment.