[XviD-devel] Memory leak using decoder?

DT darktyco at chartermi.net
Wed Dec 1 14:46:22 CET 2004


I am trying to use XviD in my application to decode video, and 
everything appeared to be working fine until I checked memory usage. The 
amount of free memory available on the system steadily declines as my 
program runs. However, if I comment out the line that calls the decoder, 
this huge memory waste does not occur. I am calling the decoder almost 
exactly like the API example program does:

    memset(&xvid_dec_frame, 0, sizeof(xvid_dec_frame_t));

    xvid_dec_frame.version = XVID_VERSION;
    decoder_stats->version = XVID_VERSION;

    xvid_dec_frame.general          = 0;

    /* Input properties */
    xvid_dec_frame.bitstream        = buf_ptr;
    xvid_dec_frame.length           = new_bytes;

    /* Output properties */
    xvid_dec_frame.output.plane[0]  = out_buffer;
    xvid_dec_frame.output.stride[0] = stream_x_dim*2;
    xvid_dec_frame.output.csp       = XVID_CSP_YUY2;

    out = xvid_decore(decoder_handle, XVID_DEC_DECODE, &xvid_dec_frame, 
decoder_stats);

    return out;

Is there something wrong with how I am calling the decoder? Should I be 
freeing some buffer the decoder creates each frame? Or is there a known 
memory leak in XviD when using YUY2 or something? As I said before, 
commenting out the xvid_decore call causes the problem to go away. 
Sorry, I'm pretty new to using video decoders myself like this. I would 
really appreciate any advice that could help me figure this out!

Thanks,
Kyle


More information about the XviD-devel mailing list