Skip to content

Report Memory leak  #56

@ohjiwoo123

Description

@ohjiwoo123

If I make just movie box and release the movie box.
there is memory leak (still reachable) in Mp4NewMovieExt

memory leak test with valgrind below

valgrind --leak-check=full --error-limit=no execute_filename

image

And also There is a Memory Leak in sample Entry Handler for AVC1 (or avc1 atom).
I think that If I try MP4AddMediaSamples , there is memory leak in sample Entry Handler for AVC1(or avc1 atom).
I Call MP4AddMediaSamples 4times in this program and 128 bytes four blocks (each 32bytes)

==120327==
==120327== HEAP SUMMARY:
==120327==     in use at exit: 430 bytes in 10 blocks
==120327==   total heap usage: 1,090 allocs, 1,080 frees, 22,674,917 bytes allocated
==120327==
==120327== 36 (32 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 10
==120327==    at 0x4C2BF79: calloc (vg_replace_malloc.c:762)
==120327==    by 0x41CB2F: MP4NewHandle (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44E682: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419C33: MP4ParseAtom (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44FD20: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x4749E7: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x470EE3: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x421E46: MP4AddMediaSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x407064: muxer::isobmff::CMuxer::SetAvcSampleDescription(muxer::isobmff::VideoStreamInfo, muxer::isobmff::CMuxer::TrackMedia&, std::string&) (muxer.cpp:531)
==120327==    by 0x405BBB: muxer::isobmff::CMuxer::AddTrack(muxer::isobmff::TrackInfo, unsigned int&, std::string&) (muxer.cpp:163)
==120327==
==120327== 36 (32 direct, 4 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 10
==120327==    at 0x4C2BF79: calloc (vg_replace_malloc.c:762)
==120327==    by 0x41CB2F: MP4NewHandle (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44E682: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419C33: MP4ParseAtom (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44FD20: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x4749E7: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x470EE3: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x421E46: MP4AddMediaSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x407064: muxer::isobmff::CMuxer::SetAvcSampleDescription(muxer::isobmff::VideoStreamInfo, muxer::isobmff::CMuxer::TrackMedia&, std::string&) (muxer.cpp:531)
==120327==    by 0x405D95: muxer::isobmff::CMuxer::AddTrack(muxer::isobmff::TrackInfo, unsigned int&, std::string&) (muxer.cpp:176)
==120327==
==120327== 71 (32 direct, 39 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 10
==120327==    at 0x4C2BF79: calloc (vg_replace_malloc.c:762)
==120327==    by 0x41CB2F: MP4NewHandle (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44E56C: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419C33: MP4ParseAtom (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44FD20: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x4749E7: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x470EE3: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x421E46: MP4AddMediaSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x407064: muxer::isobmff::CMuxer::SetAvcSampleDescription(muxer::isobmff::VideoStreamInfo, muxer::isobmff::CMuxer::TrackMedia&, std::string&) (muxer.cpp:531)
==120327==    by 0x405BBB: muxer::isobmff::CMuxer::AddTrack(muxer::isobmff::TrackInfo, unsigned int&, std::string&) (muxer.cpp:163)
==120327==
==120327== 71 (32 direct, 39 indirect) bytes in 1 blocks are definitely lost in loss record 8 of 10
==120327==    at 0x4C2BF79: calloc (vg_replace_malloc.c:762)
==120327==    by 0x41CB2F: MP4NewHandle (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44E56C: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419C33: MP4ParseAtom (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x44FD20: createFromInputStream (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x419A03: MP4ParseAtomUsingProtoList (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x4749E7: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x470EE3: addSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x421E46: MP4AddMediaSamples (in /home/jwoh/mediastreamingserver/src/module/muxer/isobmff/example/build/muxer_tests)
==120327==    by 0x407064: muxer::isobmff::CMuxer::SetAvcSampleDescription(muxer::isobmff::VideoStreamInfo, muxer::isobmff::CMuxer::TrackMedia&, std::string&) (muxer.cpp:531)
==120327==    by 0x405D95: muxer::isobmff::CMuxer::AddTrack(muxer::isobmff::TrackInfo, unsigned int&, std::string&) (muxer.cpp:176)
==120327==
==120327== LEAK SUMMARY:
==120327==    definitely lost: 128 bytes in 4 blocks
==120327==    indirectly lost: 86 bytes in 4 blocks
==120327==      possibly lost: 0 bytes in 0 blocks
==120327==    still reachable: 216 bytes in 2 blocks
==120327==         suppressed: 0 bytes in 0 blocks
==120327== Reachable blocks (those to which a pointer was found) are not shown.
==120327== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==120327==
==120327== For counts of detected and suppressed errors, rerun with: -v
==120327== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 0 from 0)

Additionally, I guess that below atoms have memory leak.

atom type : avc1 
atom name : visual sample entry

atom type : avcC
atom name : VCConfig

**VCConfig.c** **259 line**
err = self->super->createFromInputStream(s, proto, (char *)inputStream);

**VisualSampleEntryAtom.c** **91 line**
err = self->super->createFromInputStream(s, proto, (char *)inputStream);

I am gonna choose other library due to some memory leak of this lib.
But, I still want to contribute for this library.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions