Posted: Wed Feb 28, 2024 6:56 pm Post subject: Which tools to use to track down a memory leak in a game?
I'm trying to figure out the cause of a memory leak-related crash in Sheep, Dog 'n' Wolf, an old PC game from 2001. Most of what I know about assembly, computer memory, etc has been self-taught by using Cheat Engine, so there's a lot of stuff that I don't fully understand. I'm hoping someone can point me toward some good next steps to take to try to find the bug or oversight that causes this to happen.
I have a basic idea of what's going on. Every time a level is loaded (including when you restart a level), the game loads the level data and never releases it. If you load Level 5 twenty times, you'll have 20 copies of Level 5's data just taking up space. If you do this enough, the game will eventually crash.
- It doesn't always crash after the same number of level-loads, even when loading the same level over and over.
- It doesn't always crash at the same quantity of memory used.
- In addition to crashing when you try to load a level, the crash can also occur when you press Esc to open the pause menu. This makes me wonder if there's some oversight that causes the game to overwrite level data with dinput data, or vice-versa, when memory gets cramped.
I was able to use the Graphical Memory View to find the region of memory that the level data is being added to, but I'm not sure what to do with that information. My gut says I need to track down the assembly code responsible for looking through that memory region and finding available space, but I haven't had any luck so far. I'm not sure how to use the "watch memory allocations" or "watch memory page access" tools, but they seem like they might be what I'd want to use, yeah?
What tools would you use to try to find the root cause of an issue like this? I'm not sure it's even something that's fixable at this point, but if it is, fixing it would be a huge help. Thanks in advance if anyone has any pointers.
Joined: 09 May 2003 Posts: 25298 Location: The netherlands
Posted: Wed Feb 28, 2024 7:47 pm Post subject:
depends on the allocation method.
virtualalloc or heap?
Then depending on the type write a recording routine that tracks the allocated level info, and on new level delete the older level (a level or 2 behind just in case the old one is still referenced) _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum