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

Memory leak in IPP sample JPEG encoder

martishka
Beginner
341 Views
Hi,
I have created a custom JPEG encoder/decoder using the sample encoder/decoder from the IPP sample and I found out there is an memory leak in the jpeg encoder "ipp-samples\\image-codecs\\uic\\src\\codec\\image\\jpeg\\enc\\src\\jpegenc.cpp".
Actually the are two memory leaks. One is in theCJPEGEncoder::Clean function:
CJPEGEncoder::Clean
...
m_jpeg_restart_interval = 0;
m_jpeg_mode = JPEG_BASELINE;
...
#ifdef _OPENMP
if(m_jpeg_restart_interval != 0 && JT_RSTI == m_threading_mode)
{
for(i = 0; i < m_num_threads; i++)
{
m_state_t.Destroy();
m_BitStreamOutT.Detach();
}
delete[] m_state_t;
delete[] m_BitStreamOutT;
}
#endif
m_jpeg_restart_interval is never different from 0 :)
The other one isCJPEGEncoder::Init (this one is a bit tricky). If one CJPEGEncoder is used to encode multiple files with identical size and color parameters each time whenCJPEGEncoder::WriteHeader() is called more and more memory is "leaked".CJPEGEncoder::WriteHeader calls Init which frees all previous allocated memory except when allocating the resources for the Restart Interval (RSTI) threading model.
CJPEGEncoder::Init
...
#ifdef _OPENMP
if(m_jpeg_restart_interval != 0 && JT_RSTI == m_threading_mode)
{
m_BitStreamOutT = new CBitStreamOutput[m_num_threads];
buflen = m_numxMCU * m_mcuWidth*m_mcuHeight*m_rstiHeight*m_jpeg_ncomp;
for(i =0; i < m_num_threads; i++)
{
m_BitStreamOutT.Init(buflen);
}
...
I found a solution for myself but it will be good if the problem is fixed in the next releases :)
PS: the m_lastDC variable is also never deallocated :)
Best
Martin.
0 Kudos
2 Replies
Sergey_Ryadno
New Contributor I
341 Views
Hi,
thanks for reporting this issue, but this problemhas been solvedsome time ago. And fixed version will be available in next IPP release ( i suggest in 7.0.5).
0 Kudos
martishka
Beginner
341 Views
That's good to know.
0 Kudos
Reply