Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Any way of detecting memory leak in ipp

binjian
Beginner
523 Views
Hello all:

Is there any simple way to detect memory leak when using Ipp? I mean I can detect usual leak caused by malloc or new using "_CrtDumpMemoryLeaks()" in VS. But it seems that the memory leaks by ipp*malloc* were not found.

0 Kudos
2 Replies
binjian
Beginner
523 Views
After trying some times I came to a clumsy solution. However it works:

I replaced the ippimalloc and ippifree with self-defined function like the following.
Somewhere it is stated that all the ipp functions work with normally allocated memory. Then with microsoft built-in memory-leak detection all the leaks can be detected.


#ifdef _DEBUG

#define ippiMalloc_32f_C1(i,j,step) db_ippiMalloc_32f_C1(i,j,step)
#define ippiFree(ptr) db_ippiFree(ptr);

#endif _DEBUG
....


Ipp32f *db_ippiMalloc_32f_C1(int i,int j,int *step)
{
*step=i*sizeof(float);
return (Ipp32f *)malloc(j*(*step));
}

....

void db_ippiFree(void *ptr)
{
free(ptr);
}
....


0 Kudos
Vladimir_Dudnik
Employee
523 Views

Hi,

you are absolutely correct, IPP functions must work with externally allocated memory (the only drawback here is some reduce in performance, because of unaligned memory access, but it is acceptable for debug build).

Thank you for sharing your trick here

Regards,
Vladimir

0 Kudos
Reply