Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pizza Tower's scr_player_mach3 causes a memory leak. #1446

Closed
lerp32 opened this issue Jul 29, 2023 · 3 comments · Fixed by #1455
Closed

Pizza Tower's scr_player_mach3 causes a memory leak. #1446

lerp32 opened this issue Jul 29, 2023 · 3 comments · Fixed by #1455
Labels
bug Something isn't working

Comments

@lerp32
Copy link

lerp32 commented Jul 29, 2023

Describe the bug

When you open Pizza Tower's scr_player_mach3 script, a memory leak occurs.
I believe this happens because scr_player_mach3 is one big switch statement and the decompiler doesn't stop reading it when it ends, causing a memory leak.

Reproducing steps

  1. Open Pizza Tower's data.win
  2. Open scr_player_mach3

Setup Details

  1. UndertaleModTool v0.5.1.0
  2. Windows 10
  3. Pizza Tower v1.0.311 (Link)
@lerp32 lerp32 added the bug Something isn't working label Jul 29, 2023
@fixdude
Copy link
Contributor

fixdude commented Jul 29, 2023

scr_player_mach3 is not a big switch statement. don't really know why this issue occurs but i don't even think there are switch statements in scr_player_mach3.
ps. you need to delete scr_player_mach3's code through disassembly to use search functions. you can also see its disassembled code but not decompiled.

@Jacky720
Copy link
Contributor

It does contain about 680 lines of switch statement, but it has only three cases. There may be an issue with parsing something within the switch that affects the decompilation of the rest of the switch.

@Archie-osu
Copy link
Contributor

Here's the stacktrace for reference, took about 21GB of allocation to even get it to output that.

/* EXCEPTION!
   System.OutOfMemoryException: Insufficient memory to continue the execution of the program.
   at System.Collections.Generic.Queue`1.SetCapacity(Int32 capacity)
   at System.Collections.Generic.Queue`1.Enqueue(T item)
   at UndertaleModLib.Decompiler.Decompiler.DetermineSwitchEnd(Block start, Block end, Block meetPoint) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3958
   at UndertaleModLib.Decompiler.Decompiler.HLDecompileBlocks(DecompileContext context, Block& block, Dictionary`2 blocks, Dictionary`2 loops, Dictionary`2 reverseDominators, List`1 alreadyVisited, Block currentLoop, Block stopAt, Block breakTo, Boolean decompileTheLoop, UInt32 depth) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3574
   at UndertaleModLib.Decompiler.Decompiler.HLDecompile(DecompileContext context, Dictionary`2 blocks, Block entryPoint, Block rootExitPoint) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3699
   at UndertaleModLib.Decompiler.Decompiler.Decompile(UndertaleCode code, GlobalDecompileContext globalContext, Action`1 msgDelegate) in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModLib\Decompiler\Decompiler.cs:line 3819
   at UndertaleModTool.UndertaleCodeEditor.<>c__DisplayClass43_1.<DecompileCode>b__1() in D:\a\UndertaleModTool\UndertaleModTool\UndertaleModTool\Editors\UndertaleCodeEditor.xaml.cs:line 653
*/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants