[mythtv] hdtvrecorder: dynamic ringbuffers?
Daniel Thor Kristjansson
danielk at mrl.nyu.edu
Wed Dec 22 14:03:14 UTC 2004
On Wed, 22 Dec 2004, Doug Larrick wrote:
]John Patrick Poet wrote:
]> I have written a version of the hdtvrecorder ringbuffer code which creates a
]> variable number of ringbuffers, per recording.
]> Each ringbuffer is 20mb in size. If a ringbuffer fills up, another
]IMHO, and not having tried it, the new system sounds like a winner. The only
]big problem I see is if the system goes into swap, it would spiral out of
]control needing more and more buffers as it struggles to keep up. Perhaps
]detecting the amount of physical RAM in the system and limiting to (say) half
]of it (total) for ringbuffers would be the way to go.
Again, not having tried it, I like this system better. The more I think
about it the more I think you can't avoid the possible swap problem with
page locking as I suggested before. Other important parts of the program
would get swapped out instead, and it requires privledge elevation (yuck!).
But by decreasing memory usage this patch will probably avoid the
problem altogether with reasonable memory and hard drive requirements.
Perhaps growing buffer allocations make sense? Say 5mb, then 10mb,
and finally capped at 20mb? Then if a 5mb buffer is sufficient you only
use 5mb for the buffer, if 10mb is sufficient the 5mb buffer
eventually gets freed and you continue to use just 10mb. Capping at 20mb
avoids wasting 49% of a 80mb or 160mb buffer.
-- Daniel
More information about the mythtv-dev
mailing list