dMZX Forums: Memory Issues -> Archived MegaZeux Bugs -> Tracker

Jump to content

Report ID 494 Title Memory Issues
Product Archived MegaZeux Bugs Status Fixed (Severity 3 - Medium)
Version - Fixed in 2.92f
Introduced In Version ----Operating System Linux

Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Report ID #494: Memory Issues

#1 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 14 June 2012 - 09:39 PM

Thread for me to post everything found by valgrind until I get a chance to diagnose it properly.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository


Page 1 of 1  
  • Cannot start a new Issue
  • Closed Issue This issue is locked

Replies (1 - 15)

#2 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 14 June 2012 - 09:42 PM

Memory Leak summary! The huge lost number is from a path not getting cleared during editor tests.
==27744== LEAK SUMMARY:
==27744==    definitely lost: 4,188 bytes in 13 blocks
==27744==    indirectly lost: 176 bytes in 4 blocks
==27744==      possibly lost: 70,009 bytes in 1,375 blocks
==27744==    still reachable: 134,938 bytes in 1,394 blocks
==27744==         suppressed: 0 bytes in 0 blocks


No longer occurs, probably was due to a bug in zlib and/or libpng.
Spoiler


This leak was likely caused by saving uninitialized data in the board name array (2.84b world.c:705; ftell is right after the board names are saved). The ZIP save equivalent of this report was fixed in GIT 5b5bbf0a.
Spoiler

This post has been edited by Lachesis: 27 September 2020 - 09:13 PM

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#3 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 14 June 2012 - 11:26 PM

This one was caused by a path not getting freed for editor tests.
<<removed>>
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#4 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 14 June 2012 - 11:31 PM

I have no idea what's causing this one:
==27969== 26 bytes in 1 blocks are definitely lost in loss record 58 of 309
==27969==    at 0x4C28254: realloc (vg_replace_malloc.c:525)
==27969==    by 0x4E804FD: check_realloc (util.c:110)
==27969==    by 0x4E6977F: reallocate_robot (robot.c:842)
==27969==    by 0x51C5798: delete_robot_lines (robo_ed.c:344)
==27969==    by 0x51CCBA3: robot_editor (robo_ed.c:4254)
==27969==    by 0x51C4C78: edit_robot (param.c:1091)
==27969==    by 0x51B4A4F: change_param (edit.c:446)
==27969==    by 0x51B526A: thing_menu (edit.c:675)
==27969==    by 0x51B7F17: __edit_world (edit.c:1797)
==27969==    by 0x4E5ACA7: title_screen (game.c:2470)
==27969==    by 0x404675: main (main.c:163)


Leak fixed -- something wasn't getting freed during testing.
<<removed>>
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#5 User is offline  
ajs 

  • carpe diem
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,614
  • Joined: 21-October 00
  • Gender:Male
  • Location:United Kingdom

Posted 16 June 2012 - 10:42 AM

The "definitely lost" bugs are worth investigating. OTOH, your summary shows just over 4k "definitely lost" which is really very good.

The syscall warning from ftell() looks like a valgrind bug -- even if it isn't, and it's a libc bug, I don't think you can fix it. Add it to valgrind.supp in the root directory of the MZX sources (you might also want to remove all the SDL ones we put there because I guess they've been fixed??).

"Conditional jump or move depends on uninitialised value(s)" this is probably a bug, I think you'll need to install the debug symbols for zlib and libpng (if your distro doesn't have them, just build them from source and put them in LD_LIBRARY_PATH so it loads then preferentially). Then you can use gdb to figure out what line triggers the valgrind error. I'd guess it's a libpng bug?

--ajs.

#6 User is offline  
ajs 

  • carpe diem
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,614
  • Joined: 21-October 00
  • Gender:Male
  • Location:United Kingdom

Posted 16 June 2012 - 10:45 AM

On the inflateReset2, looks like this might be the same as this debian bug:

http://bugs.debian.o....cgi?bug=577135

Which is a valgrind false positive due to some weird code structure in zlib. Apparently fixed in newer zlibs.

--ajs.

#7 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 16 June 2012 - 06:06 PM

The two I took out of my posts when I fixed them were the same leak and were what was causing the 4K reported in that summary -- I also fixed a leak in overlay move block actions (level_id buffer wasn't being freed) that I happened across.

I'm using whatever zlib is in the Ubuntu 10.10 repository. Time to upgrade.

I did a quick search on the Syscall one and it looks like Chromium development had the same issue crop up in Linux -- all they did was added it to their .supp, which sounds like probably the best thing to do in this case.

I still need to look further into the other "definitely lost" bug -- there's also at least 8 more bytes being "definitely lost" per run but I missed those in the full memory check log, the full memory check ignores suppressions so there's a lot to skip past.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#8 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 13 December 2012 - 02:40 PM

The editor is leaking the buffer robot's label list somewhere. It's resisted my attempts to fix it so far so I'll have to take a closer look.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#9 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 11 July 2019 - 05:42 AM

I'm 99% certain the robot label list leaking bugs are all fixed as of GIT 88e3623d, as well as some other nasty robot leaks in the editor. A leak in the SWAP WORLD command was also fixed in GIT 9b03653e.

There's a new leak I'm seeing with AddressSanitizer and make test where sometimes the vlayer is leaked. Not sure what the cause is, and fsafetranslate seems buggy wrt directories when testing with valgrind, so make test doesn't even work. I don't know why the backtrace is obfuscated, as --fno-omit-stack-pointer is enabled, but it's definitely the vlayer.

Spoiler

"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#10 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 17 July 2019 - 08:50 AM

Fixed the vlayer memory leak in GIT f7034e4b.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#11 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 28 September 2020 - 08:18 AM

I've hidden the issues that are known to be fixed or false positives. The only one left is the robot editor delete_robot_lines issue and I've had no luck in reproducing it.

Other recent changes of note:
  • valgrind

  • AddressSanitizer
    • GIT 5b5bbf0a fixed the modern equivalent of that save_world ftell uninitialized read bug above. This was being reported because the board name buffers were not initialized past their null terminators.

  • ThreadSanitizer
    • Currently fixing the bad synchronization in sfx.c, which ThreadSanitizer has repeatedly noted. (Turns out a circular buffer designed for DOS doesn't really translate well to threads, who'd have thought!)
    • ThreadSanitizer complains about the thread ID checking I added to make the audio lock debug messages appear less. This should be fixed.


Also, since this issue has a very badly defined scope, it's now about these threading issues and that delete_robot_lines leak. New valgrind/AddressSanitizer/ThreadSanitizer/etc reports aside from these after 2.92f is released should get their own issues.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#12 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 30 September 2020 - 04:18 AM

The ThreadSanitizer issues in the previous post were fixed in GIT a1e6a04e (aside from a 'data race' report for sound_in_queue() that really doesn't hurt anything).
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#13 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 01 October 2020 - 07:17 AM

I've confirmed that the "delete_robot_lines" leak was one of the leaks fixed by GIT 88e3623d. This was actually being leaked by grab_at_xy, which would conditionally fail to clear the robot in the buffer, then unconditionally overwrite it. This bug can be replicated in 2.84c (and probably everything else prior to 2.92) by entering the editor, using F10 to create a robot, then pressing enter to edit the robot on the board at least once and exiting MZX.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#14 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 10 October 2020 - 05:41 AM

I missed another board name uninitialized value bug that could cause valgrind spam when saving. Fixed in GIT 67c9879b.
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#15 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 16 January 2021 - 09:45 PM

Updating status to: Fixed
Issue fixed in: 2.92f

As mentioned above, I think further reports should get new issues so they are easier to keep track of. (Finally closing this thing...)
"Let's just say I'm a GOOD hacker, AND virus maker. I'm sure you wouldn't like to pay for another PC would you?"

xx̊y (OST) - HELLQUEST (OST) - Zeux I: Labyrinth of Zeux (OST) (DOS OST)
w/ Lancer-X and/or asgromo: Pandora's Gate - Thanatos Insignia - no True(n) - For Elise OST
MegaZeux: Online Help File - Keycode Guide - Joystick Guide - Official GIT Repository

#16 User is offline  
Lachesis 

  • the pinnacle of human emotion
  • Group: DigiStaff
  • Posts: 3,904
  • Joined: 17-July 04
  • Gender:Female
  • Location:Sealand

Posted 16 January 2021 - 09:45 PM

Moving to: Archived MegaZeux Bugs


Page 1 of 1
  • Cannot start a new Issue
  • Closed Issue This issue is locked

1 User(s) are reading this issue
1 Guests and 0 Anonymous Users


Powered by IP.Tracker 1.3.2 © 2024  IPS, Inc.