[rtmpdump] [PATCH] Allocate the channel arrays dynamically

Martin Storsjö martin at martin.st
Wed May 30 23:15:33 CEST 2012


On Wed, 30 May 2012, Howard Chu wrote:

> Martin Storsjo wrote:
>> This avoids having to allocate space for all theoretical channels
>> if most of them aren't used. This drops the size of the full
>> RTMP struct from over 1200 KB to 16 KB (on 64 bit), and as long as
>> only channels with a low number are used, the amount of total
>> allocated memory stays far below what it was before.
>
> Wasted effort. Most commercial sites now use a channel number > 512 anyway, 
> to trip a bug in old freeware RTMP implementations that didn't handle 
> multi-byte channel numbers.

Ok - didn't know that.

Regardless, for all the other cases when using librtmp for general purpose 
RTMP stuff (acting as a server), or when dealing with servers that don't 
do this (or if it's still significantly smaller than the maximum), there's 
quite a bit of memory to save - but I won't insist.

// Martin


More information about the rtmpdump mailing list