Opened 2 years ago

Closed 2 years ago

#10209 closed defect (fixed)

TITANIC: Memory leaks in CStarControl

Reported by: csnover Owned by: dreammaster
Priority: normal Component: Engine: Titanic
Keywords: Cc:
Game: Starship Titanic

Description

valgrind reports from dafioram

==16727== 10,552 (40 direct, 10,512 indirect) bytes in 1 blocks are definitely lost in loss record 2,606 of 2,668
==16727==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16727==    by 0x56A8F2: Common::ReadStream::readStream(unsigned int) (stream.cpp:39)
==16727==    by 0x3213AB: Titanic::CFilesManager::getResource(Titanic::CString const&) (files_manager.cpp:147)
==16727==    by 0x319985: Titanic::CStarPoints1::initialize() (star_points1.cpp:39)
==16727==    by 0x317A13: Titanic::CStarField::initDocument() (star_field.cpp:55)
==16727==    by 0x30AA9A: Titanic::CStarControl::load(Titanic::SimpleFile*) (star_control.cpp:63)
==16727==    by 0x21FC24: Titanic::CProjectItem::loadData(Titanic::SimpleFile*) (project_item.cpp:291)
==16727==    by 0x21F711: Titanic::CProjectItem::loadGame(int) (project_item.cpp:197)
==16727==    by 0x347AAC: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:89)
==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== 10,552 (40 direct, 10,512 indirect) bytes in 1 blocks are definitely lost in loss record 2,607 of 2,668
==16727==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16727==    by 0x56A8F2: Common::ReadStream::readStream(unsigned int) (stream.cpp:39)
==16727==    by 0x3213AB: Titanic::CFilesManager::getResource(Titanic::CString const&) (files_manager.cpp:147)
==16727==    by 0x319985: Titanic::CStarPoints1::initialize() (star_points1.cpp:39)
==16727==    by 0x317A59: Titanic::CStarField::initDocument() (star_field.cpp:59)
==16727==    by 0x30AA9A: Titanic::CStarControl::load(Titanic::SimpleFile*) (star_control.cpp:63)
==16727==    by 0x21FC24: Titanic::CProjectItem::loadData(Titanic::SimpleFile*) (project_item.cpp:291)
==16727==    by 0x21F711: Titanic::CProjectItem::loadGame(int) (project_item.cpp:197)
==16727==    by 0x347AAC: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:89)
==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== 10,552 (40 direct, 10,512 indirect) bytes in 1 blocks are definitely lost in loss record 2,608 of 2,668
==16727==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==16727==    by 0x56A8F2: Common::ReadStream::readStream(unsigned int) (stream.cpp:39)
==16727==    by 0x3213AB: Titanic::CFilesManager::getResource(Titanic::CString const&) (files_manager.cpp:147)
==16727==    by 0x31A42F: Titanic::CStarPoints2::initialize() (star_points2.cpp:36)
==16727==    by 0x317A74: Titanic::CStarField::initDocument() (star_field.cpp:61)
==16727==    by 0x30AA9A: Titanic::CStarControl::load(Titanic::SimpleFile*) (star_control.cpp:63)
==16727==    by 0x21FC24: Titanic::CProjectItem::loadData(Titanic::SimpleFile*) (project_item.cpp:291)
==16727==    by 0x21F711: Titanic::CProjectItem::loadGame(int) (project_item.cpp:197)
==16727==    by 0x347AAC: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:89)
==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)

Build: 1.10.0git-4914-g294503f516

Change History (5)

comment:1 by dreammaster, 2 years ago

Owner: set to dreammaster
Resolution: fixed
Status: newclosed

comment:2 by dafioram, 2 years ago

Resolution: fixed
Status: closednew

Load save on bridge in front of helmet:

==10961== 408,288 (176 direct, 408,112 indirect) bytes in 1 blocks are definitely lost in loss record 2,329 of 2,329
==10961==    at 0x4C2E0EF: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==10961==    by 0x53320F: Titanic::OSScreenManager::createSurface(int, int, int) (screen_manager.cpp:321)
==10961==    by 0x526F1F: Titanic::CStarView::resizeSurface(Titanic::CScreenManager*, int, int, Titanic::CVideoSurface**) (star_view.cpp:516)
==10961==    by 0x526BD6: Titanic::CStarView::fn18(Titanic::CStarCamera*) (star_view.cpp:448)
==10961==    by 0x525693: Titanic::CStarView::reset() (star_view.cpp:78)
==10961==    by 0x514378: Titanic::CStarControl::load(Titanic::SimpleFile*) (star_control.cpp:72)
==10961==    by 0x43147E: Titanic::CProjectItem::loadData(Titanic::SimpleFile*) (project_item.cpp:295)
==10961==    by 0x430F86: Titanic::CProjectItem::loadGame(int) (project_item.cpp:201)
==10961==    by 0x551A80: Titanic::CMainGameWindow::applicationStarting() (main_game_window.cpp:91)
==10961==    by 0x423015: Titanic::TitanicEngine::initialize() (titanic.cpp:127)
==10961==    by 0x423199: Titanic::TitanicEngine::run() (titanic.cpp:154)
==10961==    by 0x40E05D: runGame(PluginSubclass<MetaEngine> const*, OSystem&, Common::String const&) (main.cpp:263)

comment:3 by dafioram, 2 years ago

Bridge helmet on then off:

==2533== 408,000 bytes in 1 blocks are possibly lost in loss record 2,334 of 2,337
==2533==    at 0x4C2FB55: calloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2533==    by 0x6A35A4: Graphics::Surface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (surface.cpp:74)
==2533==    by 0x69BADF: Graphics::ManagedSurface::create(unsigned short, unsigned short, Graphics::PixelFormat const&) (managed_surface.cpp:99)
==2533==    by 0x69B730: Graphics::ManagedSurface::ManagedSurface(int, int, Graphics::PixelFormat const&) (managed_surface.cpp:51)
==2533==    by 0x56F3CF: Titanic::DirectDrawSurface::create(int, int, int) (direct_draw_surface.cpp:47)
==2533==    by 0x56EFDC: Titanic::DirectDraw::createSurfaceFromDesc(Titanic::DDSurfaceDesc const&) (direct_draw.cpp:52)
==2533==    by 0x56F202: Titanic::DirectDrawManager::createSurface(int, int, int, int) (direct_draw.cpp:96)
==2533==    by 0x533201: Titanic::OSScreenManager::createSurface(int, int, int) (screen_manager.cpp:320)
==2533==    by 0x526F1F: Titanic::CStarView::resizeSurface(Titanic::CScreenManager*, int, int, Titanic::CVideoSurface**) (star_view.cpp:516)
==2533==    by 0x5261BB: Titanic::CStarView::fn2() (star_view.cpp:284)
==2533==    by 0x5148B1: Titanic::CStarControl::doAction(Titanic::StarControlAction) (star_control.cpp:171)
==2533==    by 0x42B87C: Titanic::CGameObject::starFn(Titanic::StarControlAction) (game_object.cpp:1636)

comment:4 by dafioram, 2 years ago

Spin bridge wheel and press go and seagull button

==22036== 16 bytes in 1 blocks are definitely lost in loss record 377 of 2,413
==22036==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22036==    by 0x34957F: Titanic::CGameState::addMovie(Titanic::CMovie*) (game_state.cpp:166)
==22036==    by 0x21783D: Titanic::CGameObject::playMovie(int, int, unsigned int) (game_object.cpp:662)
==22036==    by 0x276D62: Titanic::CCaptainsWheel::ActMsg(Titanic::CActMsg*) (captains_wheel.cpp:99)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x2BF308: Titanic::CMessage::execute(Titanic::CString const&, Titanic::ClassDef const*, int) (messages.cpp:80)
==22036==    by 0x29DD3E: Titanic::CWheelSpinHorn::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (wheel_spin_horn.cpp:56)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x26AD22: Titanic::CViewItem::handleMouseMsg(Titanic::CMouseMsg*, bool) (view_item.cpp:295)
==22036==    by 0x26A70B: Titanic::CViewItem::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (view_item.cpp:190)
==22036== 
==22036== 16 bytes in 1 blocks are definitely lost in loss record 378 of 2,413
==22036==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22036==    by 0x34957F: Titanic::CGameState::addMovie(Titanic::CMovie*) (game_state.cpp:166)
==22036==    by 0x21783D: Titanic::CGameObject::playMovie(int, int, unsigned int) (game_object.cpp:662)
==22036==    by 0x276D08: Titanic::CCaptainsWheel::ActMsg(Titanic::CActMsg*) (captains_wheel.cpp:95)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x2BF308: Titanic::CMessage::execute(Titanic::CString const&, Titanic::ClassDef const*, int) (messages.cpp:80)
==22036==    by 0x29D9E8: Titanic::CWheelSpin::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (wheel_spin.cpp:53)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x26AD22: Titanic::CViewItem::handleMouseMsg(Titanic::CMouseMsg*, bool) (view_item.cpp:295)
==22036==    by 0x26A70B: Titanic::CViewItem::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (view_item.cpp:190)
==22036== 
==22036== 16 bytes in 1 blocks are definitely lost in loss record 379 of 2,413
==22036==    at 0x4C2E19F: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==22036==    by 0x34957F: Titanic::CGameState::addMovie(Titanic::CMovie*) (game_state.cpp:166)
==22036==    by 0x21783D: Titanic::CGameObject::playMovie(int, int, unsigned int) (game_object.cpp:662)
==22036==    by 0x276EB3: Titanic::CCaptainsWheel::ActMsg(Titanic::CActMsg*) (captains_wheel.cpp:120)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x2BF308: Titanic::CMessage::execute(Titanic::CString const&, Titanic::ClassDef const*, int) (messages.cpp:80)
==22036==    by 0x29D672: Titanic::CWheelHotSpot::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (wheel_hotspot.cpp:60)
==22036==    by 0x2BF47F: Titanic::CMessage::perform(Titanic::CTreeItem*) (messages.cpp:107)
==22036==    by 0x2BF224: Titanic::CMessage::execute(Titanic::CTreeItem*, Titanic::ClassDef const*, int) (messages.cpp:60)
==22036==    by 0x26AD22: Titanic::CViewItem::handleMouseMsg(Titanic::CMouseMsg*, bool) (view_item.cpp:295)
==22036==    by 0x26A70B: Titanic::CViewItem::MouseButtonDownMsg(Titanic::CMouseButtonDownMsg*) (view_item.cpp:190)

comment:5 by dafioram, 2 years ago

Resolution: fixed
Status: newclosed

I can no longer get memory leaks for StarControl on 1351189575251a7fd6ebd6af62677e501077a9df, I must of been on an old commit for comments#2 and #3.

Note: See TracTickets for help on using tickets.