Opened 7 years ago
Closed 7 years ago
#10210 closed defect (fixed)
TITANIC: Memory leaks in AVISurface
Reported by: | csnover | Owned by: | dreammaster |
---|---|---|---|
Priority: | normal | Component: | Engine: Titanic |
Version: | Keywords: | ||
Cc: | Game: | Starship Titanic |
Description
valgrind reports from dafioram
==16727== 16,384 bytes in 1 blocks are possibly lost in loss record 2,612 of 2,668 ==16727== at 0x4C2FB45: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x49ABB8: Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (surface.cpp:74) ==16727== by 0x4930E5: Graphics::ManagedSurface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (managed_surface.cpp:99) ==16727== by 0x492D46: Graphics::ManagedSurface::ManagedSurface(int, int, Graphics::PixelFormat const&) (managed_surface.cpp:51) ==16727== by 0x364CA1: Titanic::AVISurface::setupDecompressor() (avi_surface.cpp:296) ==16727== by 0x364A35: Titanic::AVISurface::setVideoSurface(Titanic::CVideoSurface*) (avi_surface.cpp:258) ==16727== by 0x323ABB: Titanic::OSMovie::OSMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie.cpp:95) ==16727== by 0x322C41: Titanic::CMouseCursor::loadCursorImages() (mouse_cursor.cpp:86) ==16727== by 0x322A11: Titanic::CMouseCursor::CMouseCursor(Titanic::CScreenManager*) (mouse_cursor.cpp:64) ==16727== by 0x329A2A: Titanic::OSScreenManager::loadCursors() (screen_manager.cpp:350) ==16727== by 0x328AE0: Titanic::OSScreenManager::setMode(int, int, int, unsigned int, bool) (screen_manager.cpp:122) ==16727== by 0x347888: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:58) ==16727== ==16727== 229,824 (448 direct, 229,376 indirect) bytes in 14 blocks are definitely lost in loss record 2,649 of 2,668 ==16727== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x47A59D: Image::BitmapRawDecoder::decodeFrame(Common::SeekableReadStream&) (bmp_raw.cpp:45) ==16727== by 0x44D76A: Video::AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream*) (avi_decoder.cpp:917) ==16727== by 0x44C136: Video::AVIDecoder::handleNextPacket(Video::AVIDecoder::TrackStatus&) (avi_decoder.cpp:571) ==16727== by 0x44BC38: Video::AVIDecoder::readNextPacket() (avi_decoder.cpp:478) ==16727== by 0x450665: Video::VideoDecoder::decodeNextFrame() (video_decoder.cpp:188) ==16727== by 0x44A0DA: Video::AVIDecoder::decodeNextFrame() (avi_decoder.cpp:151) ==16727== by 0x365238: Titanic::AVISurface::renderFrame() (avi_surface.cpp:393) ==16727== by 0x364677: Titanic::AVISurface::seekToFrame(unsigned int) (avi_surface.cpp:182) ==16727== by 0x365116: Titanic::AVISurface::setFrame(int) (avi_surface.cpp:363) ==16727== by 0x323E29: Titanic::OSMovie::setFrame(unsigned int) (movie.cpp:153) ==16727== by 0x322C58: Titanic::CMouseCursor::loadCursorImages() (mouse_cursor.cpp:87) ==16727== ==16727== 27,488 (288 direct, 27,200 indirect) bytes in 3 blocks are definitely lost in loss record 2,623 of 2,668 ==16727== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x364C88: Titanic::AVISurface::setupDecompressor() (avi_surface.cpp:296) ==16727== by 0x364A35: Titanic::AVISurface::setVideoSurface(Titanic::CVideoSurface*) (avi_surface.cpp:258) ==16727== by 0x323ABB: Titanic::OSMovie::OSMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie.cpp:95) ==16727== by 0x326481: Titanic::CMovieManager::createMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie_manager.cpp:30) ==16727== by 0x32F876: Titanic::OSVideoSurface::loadMovie(Titanic::CResourceKey const&, bool) (video_surface.cpp:366) ==16727== by 0x32FDB3: Titanic::OSVideoSurface::load() (video_surface.cpp:479) ==16727== by 0x3306ED: Titanic::OSVideoSurface::loadIfReady() (video_surface.cpp:608) ==16727== by 0x32FA04: Titanic::OSVideoSurface::getWidth() (video_surface.cpp:400) ==16727== by 0x2152AD: Titanic::CGameObject::draw(Titanic::CScreenManager*, Common::Point const&) (game_object.cpp:343) ==16727== by 0x2E5BB5: Titanic::CPetGfxElement::draw(Titanic::CScreenManager*, Common::Point const&) (pet_gfx_element.cpp:76) ==16727== by 0x2E5B37: Titanic::CPetGfxElement::draw(Titanic::CScreenManager*) (pet_gfx_element.cpp:67) ==16727== 44,336 (192 direct, 44,144 indirect) bytes in 2 blocks are definitely lost in loss record 2,632 of 2,668 ==16727== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x364C88: Titanic::AVISurface::setupDecompressor() (avi_surface.cpp:296) ==16727== by 0x364A35: Titanic::AVISurface::setVideoSurface(Titanic::CVideoSurface*) (avi_surface.cpp:258) ==16727== by 0x323ABB: Titanic::OSMovie::OSMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie.cpp:95) ==16727== by 0x326481: Titanic::CMovieManager::createMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie_manager.cpp:30) ==16727== by 0x32F876: Titanic::OSVideoSurface::loadMovie(Titanic::CResourceKey const&, bool) (video_surface.cpp:366) ==16727== by 0x32FDB3: Titanic::OSVideoSurface::load() (video_surface.cpp:479) ==16727== by 0x3306ED: Titanic::OSVideoSurface::loadIfReady() (video_surface.cpp:608) ==16727== by 0x3302DF: Titanic::OSVideoSurface::setMovieFrame(unsigned int) (video_surface.cpp:558) ==16727== by 0x215995: Titanic::CGameObject::loadFrame(int) (game_object.cpp:435) ==16727== by 0x34DC1D: Titanic::CCarry::EnterViewMsg(Titanic::CEnterViewMsg*) (carry.cpp:222) ==16727== by 0x2BCD49: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107) ==16727== ==16727== 230,816 (1,440 direct, 229,376 indirect) bytes in 15 blocks are definitely lost in loss record 2,650 of 2,668 ==16727== at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x364C88: Titanic::AVISurface::setupDecompressor() (avi_surface.cpp:296) ==16727== by 0x364A35: Titanic::AVISurface::setVideoSurface(Titanic::CVideoSurface*) (avi_surface.cpp:258) ==16727== by 0x323ABB: Titanic::OSMovie::OSMovie(Titanic::CResourceKey const&, Titanic::CVideoSurface*) (movie.cpp:95) ==16727== by 0x322C41: Titanic::CMouseCursor::loadCursorImages() (mouse_cursor.cpp:86) ==16727== by 0x322A11: Titanic::CMouseCursor::CMouseCursor(Titanic::CScreenManager*) (mouse_cursor.cpp:64) ==16727== by 0x329A2A: Titanic::OSScreenManager::loadCursors() (screen_manager.cpp:350) ==16727== by 0x328AE0: Titanic::OSScreenManager::setMode(int, int, int, unsigned int, bool) (screen_manager.cpp:122) ==16727== by 0x347888: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:58) ==16727== by 0x211585: Titanic::TitanicEngine::initialize() (titanic.cpp:125) ==16727== by 0x211709: Titanic::TitanicEngine::run() (titanic.cpp:152) ==16727== by 0x1FC228: runGame(PluginSubclass<MetaEngine> const*, OSystem&, Common::String const&) (main.cpp:263) ==16727== ==16727== 408,000 bytes in 1 blocks are possibly lost in loss record 2,655 of 2,668 ==16727== at 0x4C2FB45: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16727== by 0x49ABB8: Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (surface.cpp:74) ==16727== by 0x480513: Image::CinepakDecoder::decodeFrame(Common::SeekableReadStream&) (cinepak.cpp:424) ==16727== by 0x44D76A: Video::AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream*) (avi_decoder.cpp:917) ==16727== by 0x44CC8A: Video::AVIDecoder::seekIntern(Audio::Timestamp const&) (avi_decoder.cpp:757) ==16727== by 0x45105B: Video::VideoDecoder::seek(Audio::Timestamp const&) (video_decoder.cpp:357) ==16727== by 0x449EE1: Video::AVIDecoder::seekToFrame(unsigned int) (avi_decoder.cpp:111) ==16727== by 0x36466B: Titanic::AVISurface::seekToFrame(unsigned int) (avi_surface.cpp:181) ==16727== by 0x365116: Titanic::AVISurface::setFrame(int) (avi_surface.cpp:363) ==16727== by 0x365951: Titanic::AVISurface::playCutscene(Titanic::Rect const&, unsigned int, unsigned int) (avi_surface.cpp:499) ==16727== by 0x323CDE: Titanic::OSMovie::playCutscene(Titanic::Rect const&, unsigned int, unsigned int) (movie.cpp:130) ==16727== by 0x343C35: Titanic::CGameManager::playClip(Titanic::CMovieClip*, Titanic::CRoomItem*, Titanic::CRoomItem*) (game_manager.cpp:163) ==16727==
Build: 1.10.0git-4914-g294503f516
Change History (3)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
The number of leaks related to AVISurface is substantially reduced, it looks like there are still 3 or 4 more that I can identify without trouble:
1 libsystem_malloc.dylib calloc 2 scummvm Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) scummvm/graphics/surface.cpp:74 3 scummvm Image::BitmapRawDecoder::decodeFrame(Common::SeekableReadStream&) scummvm/image/codecs/bmp_raw.cpp:46 4 scummvm Video::AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream*) scummvm/video/avi_decoder.cpp:917 5 scummvm Video::AVIDecoder::handleNextPacket(Video::AVIDecoder::TrackStatus&) scummvm/video/avi_decoder.cpp:571 6 scummvm Video::AVIDecoder::readNextPacket() scummvm/video/avi_decoder.cpp:478 7 scummvm Video::VideoDecoder::decodeNextFrame() scummvm/video/video_decoder.cpp:188 8 scummvm Titanic::AVISurface::renderFrame() scummvm/engines/titanic/support/avi_surface.cpp:391 9 scummvm Titanic::AVISurface::seekToFrame(unsigned int) scummvm/engines/titanic/support/avi_surface.cpp:181 10 scummvm Titanic::AVISurface::setFrame(int) scummvm/engines/titanic/support/avi_surface.cpp:361 11 scummvm Titanic::OSMovie::setFrame(unsigned int) scummvm/engines/titanic/support/movie.cpp:153 12 scummvm Titanic::CMouseCursor::loadCursorImages() scummvm/engines/titanic/support/mouse_cursor.cpp:85 13 scummvm Titanic::CMouseCursor::CMouseCursor(Titanic::CScreenManager*) scummvm/engines/titanic/support/mouse_cursor.cpp:63 14 scummvm Titanic::OSScreenManager::loadCursors() scummvm/engines/titanic/support/screen_manager.cpp:350 15 scummvm Titanic::OSScreenManager::setMode(int, int, int, unsigned int, bool) scummvm/engines/titanic/support/screen_manager.cpp:122 16 scummvm Titanic::CMainGameWindow::applicationStarting() scummvm/engines/titanic/main_game_window.cpp:60 17 scummvm Titanic::TitanicEngine::initialize() scummvm/engines/titanic/titanic.cpp:127 18 scummvm Titanic::TitanicEngine::run() scummvm/engines/titanic/titanic.cpp:154
2 libc++abi.dylib operator new(unsigned long) 3 scummvm Image::BitmapRawDecoder::decodeFrame(Common::SeekableReadStream&) scummvm/image/codecs/bmp_raw.cpp:45 4 scummvm Video::AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream*) scummvm/video/avi_decoder.cpp:917 5 scummvm Video::AVIDecoder::handleNextPacket(Video::AVIDecoder::TrackStatus&) scummvm/video/avi_decoder.cpp:571 6 scummvm Video::AVIDecoder::readNextPacket() scummvm/video/avi_decoder.cpp:478 7 scummvm Video::VideoDecoder::decodeNextFrame() scummvm/video/video_decoder.cpp:188 8 scummvm Titanic::AVISurface::renderFrame() scummvm/engines/titanic/support/avi_surface.cpp:391 9 scummvm Titanic::AVISurface::seekToFrame(unsigned int) scummvm/engines/titanic/support/avi_surface.cpp:181 10 scummvm Titanic::AVISurface::setFrame(int) scummvm/engines/titanic/support/avi_surface.cpp:361 11 scummvm Titanic::OSMovie::setFrame(unsigned int) scummvm/engines/titanic/support/movie.cpp:153 12 scummvm Titanic::CMouseCursor::loadCursorImages() scummvm/engines/titanic/support/mouse_cursor.cpp:85 13 scummvm Titanic::CMouseCursor::CMouseCursor(Titanic::CScreenManager*) scummvm/engines/titanic/support/mouse_cursor.cpp:63 14 scummvm Titanic::OSScreenManager::loadCursors() scummvm/engines/titanic/support/screen_manager.cpp:350 15 scummvm Titanic::OSScreenManager::setMode(int, int, int, unsigned int, bool) scummvm/engines/titanic/support/screen_manager.cpp:122 16 scummvm Titanic::CMainGameWindow::applicationStarting() scummvm/engines/titanic/main_game_window.cpp:60 17 scummvm Titanic::TitanicEngine::initialize() scummvm/engines/titanic/titanic.cpp:127 18 scummvm Titanic::TitanicEngine::run() scummvm/engines/titanic/titanic.cpp:154
2 libc++abi.dylib operator new(unsigned long) 3 scummvm Image::BitmapRawDecoder::decodeFrame(Common::SeekableReadStream&) scummvm/image/codecs/bmp_raw.cpp:45 4 scummvm Video::AVIDecoder::AVIVideoTrack::decodeFrame(Common::SeekableReadStream*) scummvm/video/avi_decoder.cpp:917 5 scummvm Video::AVIDecoder::handleNextPacket(Video::AVIDecoder::TrackStatus&) scummvm/video/avi_decoder.cpp:571 6 scummvm Video::AVIDecoder::readNextPacket() scummvm/video/avi_decoder.cpp:478 7 scummvm Video::VideoDecoder::decodeNextFrame() scummvm/video/video_decoder.cpp:188 8 scummvm Titanic::AVISurface::renderFrame() scummvm/engines/titanic/support/avi_surface.cpp:391 9 scummvm Titanic::OSMovie::setFrame(unsigned int) scummvm/engines/titanic/support/movie.cpp:153 10 scummvm Titanic::OSVideoSurface::loadMovie(Titanic::CResourceKey const&, bool) scummvm/engines/titanic/support/video_surface.cpp:367 11 scummvm Titanic::OSVideoSurface::load() scummvm/engines/titanic/support/video_surface.cpp:479 12 scummvm Titanic::OSVideoSurface::loadIfReady() scummvm/engines/titanic/support/video_surface.cpp:608 13 scummvm Titanic::OSVideoSurface::setMovieFrame(unsigned int) scummvm/engines/titanic/support/video_surface.cpp:558 14 scummvm Titanic::CGameObject::loadFrame(int) scummvm/engines/titanic/core/game_object.cpp:436 15 scummvm Titanic::CServiceElevatorWindow::EnterViewMsg(Titanic::CEnterViewMsg*) scummvm/engines/titanic/game/service_elevator_window.cpp:112 16 scummvm Titanic::CMessage::perform(Titanic::CTreeItem*) scummvm/engines/titanic/messages/messages.cpp:107 17 scummvm Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) scummvm/engines/titanic/messages/messages.cpp:60 18 scummvm Titanic::CViewItem::enterView(Titanic::CViewItem*) scummvm/engines/titanic/core/view_item.cpp:143 19 scummvm Titanic::CViewItem::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) scummvm/engines/titanic/core/view_item.cpp:199 20 scummvm Titanic::CMessage::perform(Titanic::CTreeItem*) scummvm/engines/titanic/messages/messages.cpp:107 21 scummvm Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) scummvm/engines/titanic/messages/messages.cpp:60 22 scummvm Titanic::CInputHandler::dispatchMessage(Titanic::CMessage*) scummvm/engines/titanic/input_handler.cpp:156 23 scummvm Titanic::CInputHandler::processMessage(Titanic::CMessage*) scummvm/engines/titanic/input_handler.cpp:84 24 scummvm Titanic::CInputHandler::handleMessage(Titanic::CMessage&, bool) scummvm/engines/titanic/input_handler.cpp:72 25 scummvm Titanic::CInputTranslator::leftButtonDown(int, Common::Point const&) scummvm/engines/titanic/input_translator.cpp:55 26 scummvm Titanic::CMainGameWindow::leftButtonDown(Common::Point const&) scummvm/engines/titanic/main_game_window.cpp:294 27 scummvm Titanic::Events::pollEvents() scummvm/engines/titanic/events.cpp:61 28 scummvm Titanic::Events::pollEventsAndWait() scummvm/engines/titanic/events.cpp:112 29 scummvm Titanic::TitanicEngine::run() scummvm/engines/titanic/titanic.cpp:157
2 libc++abi.dylib operator new(unsigned long) 3 scummvm Titanic::CMovieRangeInfo::getMovieEnd(Titanic::CMovieEventList&) scummvm/engines/titanic/support/movie_range_info.cpp:80 4 scummvm Titanic::AVISurface::handleEvents(Titanic::CMovieEventList&) scummvm/engines/titanic/support/avi_surface.cpp:203 5 scummvm Titanic::OSMovie::handleEvents(Titanic::CMovieEventList&) scummvm/engines/titanic/support/movie.cpp:167 6 scummvm Titanic::CGameManager::updateMovies() scummvm/engines/titanic/game_manager.cpp:235 7 scummvm Titanic::CGameManager::update() scummvm/engines/titanic/game_manager.cpp:170 8 scummvm Titanic::CMainGameWindow::onIdle() scummvm/engines/titanic/main_game_window.cpp:264 9 scummvm Titanic::Events::checkForNextFrameCounter() scummvm/engines/titanic/events.cpp:142 10 scummvm Titanic::Events::pollEvents() scummvm/engines/titanic/events.cpp:44 11 scummvm Titanic::Events::pollEventsAndWait() scummvm/engines/titanic/events.cpp:112 12 scummvm Titanic::TitanicEngine::run() scummvm/engines/titanic/titanic.cpp:157
Note:
See TracTickets
for help on using tickets.
Could I get you to regenerate your Valgrind reports again when you have a chance? One of the other fixes was to add missing freeing of the overall game view & game manager in the CMainGameWindow destructor.. these not being freed could have been the cause of all the remaining memory leaks.