On Mon, Aug 03, 2009 at 07:37:11PM +1000, stev391 at exemail.com.au wrote:
> > Also you should maybe use av_fast_malloc
> Not sure if this is a good idea, as the subtitle size is constantly
> fluctuating, what happens if I specify a smaller buffer then already
> provided and then the next round increase it to larger then ever
> provided? Will the the little bit that was not used be released properly
> (i.e not leak) along with the specified buffer length (old width * old
> height)?
Not sure what exactly you are asking.
It will keep allocated the largest size it ever had, though if really
important to someone this behaviour could be changed in one single
place.
Also it might not be that important since on the other hand it reduces
memory wasted due to heap fragmentation.
Even realloc might be better than free+malloc, except that it might
uselessly copy around the old content in some cases...