Opened 8 years ago
Closed 7 years ago
#11529 closed Bug Report - Memory Leak (fixed)
MpegRecorder as used by HDPVR looses memory leading to OOM
Reported by: | Owned by: | danielk | |
---|---|---|---|
Priority: | blocker | Milestone: | 0.27 |
Component: | MythTV - Recording | Version: | 0.26-fixes |
Severity: | high | Keywords: | |
Cc: | Ticket locked: | no |
Description
Symptom: My system (Ubuntu 12.10, Myth 0.26 latest fixes update) using HDPVR the mythbackend uses more memory over time eventually (3-4 weeks) leading to OOM issues - this has been happening for quite a few months
Just did some logging with valgrind which shows possibly lost 135M in 4 blocks from DeviceReadBuffer::Setup over 1-2 days
Adding extra logging statements to DeviceReadBuffer?.cpp and mpegrecorder.cpp gives the following analysis:
MpegRecorder::OpenV4L2DeviceAsInput allocates the _device_read_buffer but the MpegRecorder? code suggests it is not deallocated on MpegRecorder? object deletion - the _device_read_buffer only appears to be deleted on re-calling OpenV4L2DeviceAsInput (logging DeviceReadBuffer? object deletion also suggests it is never called)
Logging MpegRecorder? object creation and deletion shows a new MpegRecorder? object is created for each recording - if this is true then OpenV4L2DeviceAsInput will always be called with _device_read_buffer NULL and a new _device_read_buffer will be created which is never deleted
Not sure what is correct fix - currently trying adding the _device_read_buffer delete code at beginning of OpenV4L2DeviceAsInput of MpegRecorder? to the TearDownAll? function
This seems to work (the DeviceReadBuffer? object is now deleted after recording) but may not be consistent with the design goals of MpegRecorder?
In c329fc215c365c0fa5b8d85546adc69bd6026673/mythtv: