[FFmpeg-trac] #4058(undetermined:new): Memory leak with recording from IP-cameras in separate threads
FFmpeg
trac at avcodec.org
Mon Oct 27 14:19:02 CET 2014
#4058: Memory leak with recording from IP-cameras in separate threads
-------------------------------------+-------------------------------------
Reporter: xaruch | Type: defect
Status: new | Priority: normal
Component: | Version: 2.4.2
undetermined | Blocked By:
Keywords: memory leak | Reproduced by developer: 0
pthreas |
Blocking: |
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Hello all!
I've got a program that recording video from IP-cameras. Because to
cameras quantity is quite many I using pthreads. Also video from cameras
splitting to fragments with some length (for ex., 300 seconds).
But I have got a big problem: memory definitely leaks after each time
cycle.
For debug purposes I create simplified prototype project. Full code for it
can be found this GIT repository: https://github.com/xaruch/ffmpeg_tests
Memory increasing diagram:
[[Image(http://www.datafilehost.com/d/b2cba5ea)]]
Vertical axis is VmRss for test program pid with 1 seconds step.
Horizontal axis is time.
The main cycle:
{{{
if (PWriter->TimerCounter >= REC_TIMEOUT)
{
uint64_t mem = PWriter->GetMemoryConsumption();
sprintf(str, "DEBUG: Timeout callback. Memory: %lld.
Delta: %lld\n", mem, mem - Memory);
AppendLog(str, "MAIN");
Memory = mem;
PWriter->TimerCounter = 0;
PWriter->Continue();
}
}}}
Start recording called from this function:
{{{
int FfPipeline::ThInitiateRecording()
{
const char *class_name = "FfPipeline::ThInitiateRecording";
pthread_t ptid;
sprintf(str, "DEBUG: Pipeline slot '%d'. Try to starting thread with
stopping...\n", Slot);
AppendLog(str, class_name);
pthread_create(&ptid, NULL, &ThRecording, (void *) this);
pthread_detach(ptid);
sprintf(str, "DEBUG: Pipeline slot '%d'. Starting thread ended!\n",
Slot);
AppendLog(str, class_name);
return 0;
}
}}}
--
Ticket URL: <https://trac.ffmpeg.org/ticket/4058>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list