Opened 10 years ago
Closed 10 years ago
#4058 closed defect (needs_more_info)
Memory leak with recording from IP-cameras in separate threads
Reported by: | xaruch | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | undetermined |
Version: | unspecified | Keywords: | leak |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
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:
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; }
Attachments (2)
Change History (10)
by , 10 years ago
Attachment: | mem_leak.png added |
---|
comment:1 by , 10 years ago
libavcodec.so.56.1.100
libavdevice.so.56.0.100
libavfilter.so.5.1.100
libavformat.so.56.4.101
libavutil.so.54.7.100
libswresample.so.1.1.100
libswscale.so.3.0.100
follow-up: 3 comment:2 by , 10 years ago
Keywords: | memory pthreas removed |
---|
Please test current FFmpeg git head and please provide valgrind output for memory leaks.
comment:3 by , 10 years ago
Replying to cehoyos:
Please test current FFmpeg git head and please provide valgrind output for memory leaks.
I am attach valgrind log for running test program with last FFmpeg git head.
comment:5 by , 10 years ago
Please recompile with --disable-stripping
to make the valgrind output useful.
comment:6 by , 10 years ago
This is great!
No leaks after recompilation with this option. But I want to undestand what's this options means and how to link to memory leakage in project?
comment:7 by , 10 years ago
The option is not related to the memory leaks at all.
Your valgrind output was missing nearly all useful information because your libraries did not contain debug information (which is the default to make the libraries smaller). Recompiling with --disable-stripping
allows the valgrind output to contain more information.
comment:8 by , 10 years ago
Resolution: | → needs_more_info |
---|---|
Status: | new → closed |
Version: | 2.4.2 → unspecified |
Please reopen if you can provide a useful valgrind output (one with --disable-stripping
) that shows a memleak.
Memory leak diagram