TASEmulators / BizHawk

BizHawk is a multi-system emulator written in C#. BizHawk provides nice features for casual gamers such as full screen, and joypad support in addition to full rerecording and debugging tools for all system cores.
http://tasvideos.org/BizHawk.html
Other
2.14k stars 380 forks source link

system.OutOfMemoryException #511

Closed mouse1093 closed 8 years ago

mouse1093 commented 8 years ago

Been trying to do some TAS work for Donkey Kong 64. I get about 500 frames into TAStudio and the program experiences a fatal error and closes. Here's the contents of the dialog box that pops up:

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Object.MemberwiseClone() at BizHawk.Client.Common.TasStateManager.Capture(Boolean force) at BizHawk.Client.Common.TasMovie.GreenzoneCurrentFrame() at BizHawk.Client.Common.MovieSession.HandleMovieAfterFrameLoop() at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force) at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop() at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

StackTrace: at System.Object.MemberwiseClone() at BizHawk.Client.Common.TasStateManager.Capture(Boolean force) at BizHawk.Client.Common.TasMovie.GreenzoneCurrentFrame() at BizHawk.Client.Common.MovieSession.HandleMovieAfterFrameLoop() at BizHawk.Client.EmuHawk.MainForm.StepRunLoop_Core(Boolean force) at BizHawk.Client.EmuHawk.MainForm.ProgramRunLoop() at BizHawk.Client.EmuHawk.Program.SubMain(String[] args)

The movie is starting from a save state. I encounter this error if I advance the movie with both the playback buttons and with cursor. It also seems that when this fatal error occurs, if I say yes to attempt to save, TAStudio is then unable to properly load the tasproj the next time. The movie does not start from the proper savestate but instead from power on.

clanker-ii commented 8 years ago

IIRC TAStudio can only be used when starting a new project altogether from power on. Furthermore, TAStudio uses a TON of memory all very quickly and 500 frames in, the allotted memory gets used up and it throws the exception.

mouse1093 commented 8 years ago

You can definitely use TAStudio from save states rather than power on and I've seen plenty of other projects of dk64 and other games exceed 500 frames. 500 frames is less than 10 seconds of movie

clanker-ii commented 8 years ago

I'm creating a movie right now of Banjo Tooie, and I cannot use TAStudio either. I've been TASing without it, which is a bit more difficult, but the only way i can do it as of right now. I assume other N64 TASes that were done on BizHawk do not use TAStudio, but I could be wrong.

hegyak commented 8 years ago

Confirming this error from Power-On using TAStudio.

BizHawk Version used: Master#0564245

ROM Info: Donkey Kong 64 (USA) SHA1:CF806FF2603640A748FCA5026DED28802F1F4A50 MD5:9EC41ABF2519FC386CADD0731F6E868C

Steps to recreate: Load ROM Open TAStudio Unpause Emulator Wait Crash

I get to about Frame 380~ before EmuHawk crashes for me.

Hathor86 commented 8 years ago

Guess I point the problem.

When you debug it with visual studio, you notice that the object "StateManagerState" is about 400MB for 24 objects (16MB per object) just after the crash.

In TasStateManager.cs, function SetState (line 352), we add a new state into the list but never remove it. Flush this list to disk and keep only 10 states into memory could fix it.

PS: I also wonder why an object is twice heavier than N64 full memory with expansion pack.

vadosnaprimer commented 8 years ago

I can't stably reproduce it on the latest revision. Once I did, then I didn't, even after creating FOUR save-anchored movies one on top of another, and emulating to frame 1000 with each, and even entering that... cutscene? I have a movie if anyone wants.

Ownasaurus commented 8 years ago

I appear to have this exact same issue. I am new to this program, so I may be doing something wrong, but who knows. I'm happy to give you any information I can. The version is 1.11.4

vadosnaprimer commented 8 years ago

I think it was fixed in https://github.com/TASVideos/BizHawk/commit/178820746cd0cb8f94eb2ab7a71fff4e91f20452