JPEG-IJL memory leak

JPEG-IJL memory leak


I've been usingijl11.dll for years with no problems.

I'm repeatedly doing JPEG decompress in a loop.

When I compile the JPEG-IJL project to create
ijl20.dll using IPP40, and use the new ijl.h
the resulting code gradually leaks memory
in my app.

I'm using an eval version of Win IPP 4.0.

Any ideas?

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


could you please provide more details, what processor do you use? May be we can provide simple test case?


I submitted it to Primier support.

I'm using 1Ghz PIII mobile, Win2000, 1G RAM, Compaq Evo

Have you ever tested repeatedly decompressing JPEG's using ijl20.dll ?


of course, we tested IJL-IPP sample, and we found no problem with it. Could you reproduce this problem with JPGView sample, which comes with IJL?



I got similar problem. I'm using

in Xeon winXP. There is about 1K memory leak
each time I invoke decoder decode function.
If I replace it by JPEG sample come with
IPP 4.0 (but still use IPP 4.1 library)
there is no such problem.

Another problem is in
jpegcodecencode.cpp, in IPP 4.0 jpeg
sample we can get the length of destination
after encode. But there is no such information
return. How can we know the size of jpeg encode ?


- Kelvin


you are right, we found several mistakes in JPEGView sample's source code.

to correct memory leakage in decoder you need to remove one line in dechtbl.cpp file:

JERRCODE CJPEGDecoderHuffmanTable::Destroy(void)
m_id = 0;
m_hclass = 0;
m_table = 0; // REMOVE this line


if(0 != m_table) {
m_table = 0;

m_bEmpty = 1;

return JPEG_OK;
} // CJPEGDecoderHuffmanTable::Destroy()
The similar mistake is also in enchtbl.cpp file.

Regarding size of encoded JPEG you can use code like this:

BOOL CJPGViewDoc::SaveAsJPEG(LPCTSTR lpszPathName)
JPEGSize = encoder.m_dst.currPos; //add this code

Hi Vladimir,

Thanks for your help. It is fast.
It works now without memory leak. :-)

Another usage we're trying is reuse
single instance of decoder i.e.

CJPEGDecoder decoder;

while (true) {
// get image data here

We find there is memory leak if I do this.
is the function Reset() is design to do this ?
Cause we would like, if possible, not to
reallocate and ippFree() stuff in each frame.

Another question is how is the performance of
jpeg decode for 64-bit Xeon compare to 32 bit
Xeon ? Is it double ?
We haven't bought 64-bit xeon yet until we can verify the performance enchacement.


- Kelvin


yes, we are in preparation of the next version of IPP right now. This version will include modified JPEG sample. Modification will be related to minimization of memory allocation inside, especially for Motion JPEG case, where all frames have the same size, so internal buffers can be reused.

To free decoder internal buffersmethod Clean() should be used.

Actually, you can estimate performance of IPP on any supported platform even without that platforms. Just take a look into performance data we distribute with IPP, you can find it in your IPPia32_itanium oolsperfsysdata folder. There is results of IPP performance tests (for JPEG it includes JPEG codec performance as well as performance of separate IPP functions).



Actually I try .Clean() also in the loop
but it doesn't work. Never mind we'll wait
for the next jpeg samples which optimized
for Motion jpeg.

Thanks for your support.

- Kelvin

Leave a Comment

Please sign in to add a comment. Not a member? Join today