[vlc-devel] [PATCH] cache_block: account alloc size instead of payload

Rémi Denis-Courmont remi at remlab.net
Fri Jan 8 12:21:45 CET 2016


Le 2016-01-07 16:52, Francois Cartegnie a écrit :
> Current block_cache accounts only payload data which
> results in storing far more data, than the expected
> STREAM_CACHE_SIZE limit, when the access allocs
> larger blocks than payload.

DTV should use pf_read than than pf_block anyway. IIRC, pf_block is/was 
a work-around for deficient stream buffering. This patch will probably 
re-expose the problems again.

As for UDP-based protocols and DTV, we have ample historical evidence 
that large buffers are required, and that this patch will break things 
too. The allocated block size should be limited to the MTU minus 28 or 
48. If sender exceeds that size, sender is broken.

> Ex: UDP 2^16 (max MTU), dtv (20 * 128).
> reading re-streamed rtsp allocates more than 300MB
> before reaching the payload cache size.

In the worst case, you only waste PAGE_SIZE - 1 bytes of *actual* 
memory. So in typical cases, you waste about half of the memory - which 
is not good, but not that bad and uncommon ratio for heap.

> OOM'ing client only depends on bw if a server sends
> zero or one byte sized payload UDP (limit becoming ~12*256GB)

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list