[x264-devel] Fwd: Huge memory leak in x264_encoder_open

Ofer Shem Tov ost12666 at gmail.com
Mon May 21 14:48:00 CEST 2007


I got the x264 sources a few weeks ago from the trunk. When using it I
got a memory leak of around 800K between calling x264_encoder_open and
x264_encoder_close without doing anything between the calls.

I looked at all the allocations and it seems that several large memory
blocks are allocated in x264_encoder_open by x264_frame_pop_unused
which calls x264_frame_new( h )

    for( i = 0; i < h->param.i_threads; i++ )
    {
        ...
        h->thread[i]->fdec = x264_frame_pop_unused( h );
        ...
    }

This frame memory was not deallocated in  x264_encoder_close so I
added one line to x264_encoder_close to free it and it solved the
leak:

    for( i = h->param.i_threads - 1; i >= 0; i-- )
    {
        x264_macroblock_cache_end( h->thread[i] );
        x264_frame_delete(h->thread[i]->fdec); // ***** this line
solves the memory leak ****
        x264_free( h->thread[i]->out.p_bitstream )
        x264_free( h->thread[i] );
    }

What is the process to get this sorted out by someone who is developing x264?

Related question is how do I know when to update my x264 sources to a
newer version to something which is known to be stable? One idea is to
follow some other project that is tested and use what it is using or
just to take a snapshot when there is a week or so without any
commits....no idea really how to do it

Ofer

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list