bugWarmux - Bugs: bug #17541, valgrind detects memory leaks in...

 
 
Show feedback again

You are not allowed to post comments on this tracker with your current authentification level.

bug #17541: valgrind detects memory leaks in warmux

Submitted by:  Eddy Petrișor <eddyp>
Submitted on:  Thu 20 Jan 2011 09:15:51 PM UTC  
 
Category: NoneSeverity: 4 - Important
Priority: 5 - NormalStatus: None
Assigned to: NoneOpen/Closed: Open
Release: svn (20 jan 2011)

Wed 09 Feb 2011 10:08:10 AM UTC, SVN revision 9576:

[bug #17541] Debug prints showing the allocation and release of memory for Character class. They seem to be properly cleaned.

(Browse SVN revision 9576)

Kurosu <kurosu>
Project Administrator
Wed 26 Jan 2011 07:22:39 PM UTC, comment #3:

In fact, I solved bug #17580 which was not a corruption bug, so do as you want. warmux is relatively leak-free, I'd say.

Kurosu <kurosu>
Project Administrator
Tue 25 Jan 2011 03:37:39 AM UTC, comment #2:

Many of the leaks are probably related to SDL subsystems initialization and/or deinit (and lack thereof). I confirm the leaks about the characters, but I didn't manage to see where it was coming from (suspecting some STL behaviour here). The benchmark behaviour is indeed that all charaters die.

Not sure if you do (your last report seems to indicate you do), but I suggest you use tools/valgrind.sh. It uses a suppression file to get the leaks coming with most certainty from our code. And it also forces the game into a mode where it becomes playable, albeit at a very slow pace.

Another request, unrelated and thus not fit for this bug report... Could you also run valgrind, start a game, lay a construct, and report anything wrong to a new bug. I'm investigating a bug that makes no sense, and I'd like to rule out memory corruption.

I'd gladly do this, had I steal a valid linux install here.

Thanks in advance.

Kurosu <kurosu>
Project Administrator
Thu 20 Jan 2011 09:23:00 PM UTC, comment #1:

Here is the output after starting the game with valgrind --leak-check=full ./src/warmux

==22478==
==22478== ERROR SUMMARY: 3363 errors from 6 contexts (suppressed: 1064 from 5)
==22478== malloc/free: in use at exit: 224,944 bytes in 4,259 blocks.
==22478== malloc/free: 967,231 allocs, 962,972 frees, 298,655,604 bytes allocated.
==22478== For counts of detected errors, rerun with: -v
==22478== searching for pointers to 4,259 not-freed blocks.
==22478== checked 1,652,704 bytes.
==22478==
==22478==
==22478== 14 bytes in 2 blocks are definitely lost in loss record 5 of 62
==22478== at 0x4C2260E: malloc (vg_replace_malloc.c:207)
==22478== by 0x5BDC1CA: (within /usr/lib/libX11.so.6.2.0)
==22478== by 0x5BDC4F7: _XimSetICValueData (in /usr/lib/libX11.so.6.2.0)
==22478== by 0x5BD8847: _XimLocalCreateIC (in /usr/lib/libX11.so.6.2.0)
==22478== by 0x5BC26CC: XCreateIC (in /usr/lib/libX11.so.6.2.0)
==22478== by 0x58F5D20: (within /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x58F6C6C: (within /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x58E7F7F: SDL_VideoInit (in /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x58C1016: SDL_InitSubSystem (in /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x456391: Video::InitSDL() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x456F1C: Video::Video() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x4A5232: AppWarmux::AppWarmux() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478==
==22478==
==22478== 292 (52 direct, 240 indirect) bytes in 1 blocks are definitely lost in loss record 29 of 62
==22478== at 0x4C2260E: malloc (vg_replace_malloc.c:207)
==22478== by 0x6A675CF: (within /lib/libc-2.7.so)
==22478== by 0x6A67DA6: __nss_database_lookup (in /lib/libc-2.7.so)
==22478== by 0xC18B3DF: ???
==22478== by 0xC18C26A: ???
==22478== by 0x6A24C62: getgrnam_r (in /lib/libc-2.7.so)
==22478== by 0x6A241FF: getgrnam (in /lib/libc-2.7.so)
==22478== by 0x814A249: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x8146529: _snd_pcm_dmix_open (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x8117E93: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x8118506: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x811857F: (within /usr/lib/libasound.so.2.0.0)
==22478==
==22478==
==22478== 320 bytes in 8 blocks are possibly lost in loss record 35 of 62
==22478== at 0x4C2260E: malloc (vg_replace_malloc.c:207)
==22478== by 0x80FE1F0: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x8117EB2: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x81185BE: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x81310AC: _snd_pcm_plug_open (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x8117E93: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x81185BE: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x814CF76: _snd_pcm_asym_open (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x8117E93: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x81185BE: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x81384E9: _snd_pcm_empty_open (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x8117E93: (within /usr/lib/libasound.so.2.0.0)
==22478==
==22478==
==22478== 800 bytes in 20 blocks are definitely lost in loss record 45 of 62
==22478== at 0x4C21FCC: operator new(unsigned long) (vg_replace_malloc.c:230)
==22478== by 0x420E02: Character::Character(Team&, std::string const&, Body*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x520E91: Team::AddOnePlayingCharacter(std::string const&, Body*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x521849: Team::AddPlayingCharacters(std::vector<std::string, std::allocator<std::string> >) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x521F14: Team::LoadCharacters() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x522159: Team::LoadGamingData(WeaponsList*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x52682F: TeamsList::LoadGamingData(WeaponsList*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x435C9C: Game::InitTeams() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x438C7A: Game::InitEverything() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x439852: Game::Start(bool) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x4BF47B: BenchmarkMenu::Launch(BenchItem*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x4BFC5E: BenchmarkMenu::OnClickUp(Vector2<int> const&, int) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478==
==22478==
==22478== 800 bytes in 20 blocks are definitely lost in loss record 46 of 62
==22478== at 0x4C21FCC: operator new(unsigned long) (vg_replace_malloc.c:230)
==22478== by 0x4202FF: Character::Character(Character const&) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x520EE6: Team::AddOnePlayingCharacter(std::string const&, Body*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x521849: Team::AddPlayingCharacters(std::vector<std::string, std::allocator<std::string> >) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x521F14: Team::LoadCharacters() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x522159: Team::LoadGamingData(WeaponsList*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x52682F: TeamsList::LoadGamingData(WeaponsList*) (in /home/eddy/usr/src/wormux/[git:trunk-ups]
rmux)
==22478== by 0x435C9C: Game::InitTeams() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x438C7A: Game::InitEverything() (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x439852: Game::Start(bool) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x4BF47B: BenchmarkMenu::Launch(BenchItem*) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478== by 0x4BFC5E: BenchmarkMenu::OnClickUp(Vector2<int> const&, int) (in /home/eddy/usr/src/wormux/git-full/src/warmux)
==22478==
==22478==
==22478== 58,464 bytes in 812 blocks are possibly lost in loss record 62 of 62
==22478== at 0x4C203E4: calloc (vg_replace_malloc.c:397)
==22478== by 0x80F5AAE: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x80F5B9E: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x80F799C: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x80F7EC1: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x80F8150: (within /usr/lib/libasound.so.2.0.0)
==22478== by 0x80F9EF6: snd_config_update_r (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x80FA3F1: snd_config_update (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x8118721: snd_pcm_open (in /usr/lib/libasound.so.2.0.0)
==22478== by 0x58EC97C: (within /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x58C1AD6: SDL_AudioInit (in /usr/lib/libSDL-1.2.so.0.11.1)
==22478== by 0x58C0F9C: SDL_InitSubSystem (in /usr/lib/libSDL-1.2.so.0.11.1)
==22478==
==22478== LEAK SUMMARY:
==22478== definitely lost: 1,666 bytes in 43 blocks.
==22478== indirectly lost: 240 bytes in 10 blocks.
==22478== possibly lost: 58,784 bytes in 820 blocks.
==22478== still reachable: 164,254 bytes in 3,386 blocks.
==22478== suppressed: 0 bytes in 0 blocks.
==22478== Reachable blocks (those to which a pointer was found) are not shown.
==22478== To see them, rerun with: --leak-check=full --show-reachable=yes

I just started the game, ran the benchmark and then quit. It seems the culprit is the benchmark stuff when creating characters. BTW, after the first action of the first character all characters are reported as dead. If this not an expected result, then this might be related.

Eddy Petrișor <eddyp>
Project Member
Thu 20 Jan 2011 09:15:51 PM UTC, original submission:

After running warmux with

WARMUX_DATADIR=./data/ WARMUX_FONT_PATH=./data/font/Ubuntu-R.ttf valgrind ./src/warmux

The valgrind summary looks like this:

==21781==
==21781== ERROR SUMMARY: 6105 errors from 6 contexts (suppressed: 2138 from 5)
==21781== malloc/free: in use at exit: 237,288 bytes in 4,331 blocks.
==21781== malloc/free: 2,856,883 allocs, 2,852,552 frees, 728,605,065 bytes allocated.
==21781== For counts of detected errors, rerun with: -v
==21781== searching for pointers to 4,331 not-freed blocks.
==21781== checked 1,652,160 bytes.
==21781==
==21781== LEAK SUMMARY:
==21781== definitely lost: 14,010 bytes in 124 blocks.
==21781== possibly lost: 58,784 bytes in 820 blocks.
==21781== still reachable: 164,494 bytes in 3,387 blocks.
==21781== suppressed: 0 bytes in 0 blocks.
==21781== Rerun with --leak-check=full to see details of leaked memory.

I have ran the benchmarks twice, I have changed the resolution a few times (640x480 -> 800x600 and back), switched back and forth the player type for the second team and exited from the game right before any action happening on in the game.

I'll try to get more data.

Eddy Petrișor <eddyp>
Project Member

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by kurosu (Posted a comment)
  • -unavailable- added by eddyp (Submitted the item)
  •  

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    No Changes Have Been Made to This Item
    Show feedback again

    Back to the top


    Powered by Savane 3.1-cleanup