Memory leak for ipp version 7.0.205

Memory leak for ipp version 7.0.205

imagem de J T.

Hi all,

we are using ipp version 7.0.205 in our program. Experiments show that there are some memory leaks. After we fixed all heap-related memory leak and ran IBM Rational Purify, it points to

status = ippiMorphReconstructDilate_8u_C1IR(inMask, imgCols, reconImg, imgCols,roi, pBuffer, ippiNormL1);
            ImageIPPError::checkIppStatus (status, _CRT_WIDE(__FILE__),__LINE__);

Here is the Purify output snip.

Here is the code we were using, which is very close to IPP example in http://software.intel.com/sites/products/documentation/hpc/ipp/ippi/ippi...

    // Local manual managed resources.
    IppiMorphAdvState *state = NULL;
    Ipp8u *pBuffer = NULL;
    try
    {
        const Ipp8u* inMask = inMaskImg.getData();
        const Ipp8u* inMarker = markerImg.getData();
        Ipp8u* reconImg = outImageMask.getData();

        IppiSize roi = {imgCols, imgRows};
        int imgSize = 0;

        IppiSize msize = {3, 3};  // The structure element size
        Ipp8u mask[3*3] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
        IppiPoint anchor = {msize.width/2, msize.height/2};
    
        //Allocate memory and initialize the structure element
        IppStatus status = ippStsNoErr;
        status = ippiMorphAdvInitAlloc_8u_C1R(&state, roi, mask, msize, anchor);
        ImageIPPError::checkIppStatus (status, _CRT_WIDE(__FILE__),__LINE__);

        // Get the buffer needed for reconstruction
        status = ippiMorphReconstructGetBufferSize_8u_C1(roi, &imgSize);
        ImageIPPError::checkIppStatus (status, _CRT_WIDE(__FILE__),__LINE__);        
        //pBuffer = new Ipp8u[imgSize];
        pBuffer = ippsMalloc_8u(imgSize);

        // Use the marker image to initialize the reconstructed image
        status = ippiCopy_8u_C1R(inMarker, imgCols, reconImg, imgCols, roi);
        ImageIPPError::checkIppStatus (status, _CRT_WIDE(__FILE__),__LINE__);

        // Call reconstruction
        status = ippiMorphReconstructDilate_8u_C1IR(inMask, imgCols, reconImg, imgCols,
                                            roi, pBuffer, ippiNormL1);
        ImageIPPError::checkIppStatus (status, _CRT_WIDE(__FILE__),__LINE__);

        //delete[] pBuffer; pBuffer = NULL;
        ippsFree(pBuffer); pBuffer = NULL;
        ippiMorphAdvFree(state); state = NULL;
    }
    catch (...)
    {
        if (pBuffer != NULL)
        {
            //delete[] pBuffer; pBuffer = NULL;
            ippsFree(pBuffer); pBuffer = NULL;
        }
        if (state != NULL)
        {
            ippiMorphAdvFree(state); state = NULL;
        }
        throw;
    }

Initially, we thought we should NOT use        pBuffer = new Ipp8u[imgSize]. But even after we use pBuffer = ippsMalloc_8u(imgSize), Purify still gave the same memory leak detection.

Any suggestions, comments would be very helpful!!!

Thanks a lot!

5 posts / 0 new
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.
imagem de J T.

Purify output snip is missing. I have attached the PNG file here.

Anexos: 

AnexoTamanho
Download capture1.png45.89 KB
imagem de Chao Y (Intel)

Hello,

Can you try to link with non threaded Intel IPP library, and see if there is any error reported?  I see in the attached file, the error reported is to the OpenMP library, we notice similar case before, and openmp may internal maintain some internal buffer, and may take as the memory leak.  If you link with non threading, it will not depend on the openmp.

Thanks,
Chao

imagem de J T.

In our product code, we intend to use libiomp because of speed and performance requirement. When you notice similar case before, what other solutions have you tried? Will upgrade to 8.0 solve the issue? Thanks!

imagem de Chao Y (Intel)

Hi,

Regarding the OpenMP runtime library memory report by some memory checking tools, actually most of them is actually some false positive report. No actually memory is happening there. Some more discussion is here:

http://software.intel.com/en-us/forums/topic/279131

Thanks,
Chao

Faça login para deixar um comentário.