ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Out of Memory Error

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Out of Memory Error

Postby Lazzah » Fri Jul 27, 2012 2:57 pm

As I was playing through my adventure using macros just now, at one stage I saw error messages flash up on screen, but they were too fast for me to read. Then one appeared and stayed on screen, the error message was: "Source2HTL error: Exception of type "System.OutOfMemoryException" was thrown." The stack trace reads:

at ‘...ctor(String sErrorMessage, Exception ex)
at ADRIFT.SharedModule.(String ™, Exception ‚)
at ADRIFT.SharedModule.(String , RichTextBox& , Boolean )
at ‘..(String ‚, Boolean , Boolean )
at ‘..Œ(Int32 , Boolean )
at ‘..(String )
at ‘..‚()
at ‘..(Object , KeyEventArgs )
at ‘..(String )
at ‘..(String , String , String )
at ‘..(Object , ToolClickEventArgs )
at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.OnToolClick(ToolClickEventArgs e)
at Infragistics.Win.UltraWinToolbars.UltraToolbarsManager.FireEvent(ToolbarEventIds id, EventArgs e)
at Infragistics.Win.UltraWinToolbars.ToolBase.OnToolClick()
at Infragistics.Win.UltraWinToolbars.ToolMenuItem.OnClick()
at Infragistics.Win.UltraWinToolbars.PopupMenuItemUIElement.DoClickProcessing(MouseEventArgs e)
at Infragistics.Win.UltraWinToolbars.PopupMenuItemUIElement.OnMouseUp(MouseEventArgs e)
at Infragistics.Win.UIElement.OnMouseUp(MouseEventArgs e)
at Infragistics.Win.TextUIElementBase.OnMouseUp(MouseEventArgs e)
at Infragistics.Win.ControlUIElementBase.ProcessMouseUpHelper(Object sender, MouseEventArgs e)
at Infragistics.Win.ControlUIElementBase.ProcessMouseUp(Object sender, MouseEventArgs e)
at Infragistics.Win.Utilities.ProcessEvent(Control control, ProcessEvent eventToProcess, EventArgs e)
at Infragistics.Win.UltraControlBase.OnMouseUp(MouseEventArgs e)
at Infragistics.Win.UltraWinToolbars.PopupControlBase.OnMouseUp(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at ‘..()


Is it my game causing this or is it the PC I'm running it on...or both? It doesn't happen all the time, only now and again.

Thanks.
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Out of Memory Error

Postby Campbell » Fri Jul 27, 2012 3:32 pm

What is the spec of your machine? I haven't looked at memory optimisation for a long time. If you send me your game with macro I can see if I can improve the memory usage.
ADRIFT Developer developer.
User avatar
Campbell
Site Admin
 
Posts: 3838
Joined: Sun Jun 23, 2002 11:05 am
Location: Edinburgh, Scotland

Re: Out of Memory Error

Postby ralphmerridew » Fri Jul 27, 2012 3:50 pm

Very probably your game: Are you displaying any long blocks of text, or complex ALRs?

For example, an ALR like "x -> ABC" and "B -> xyz" will infinite-recurse on a string containing an "x" or "B". (ADRIFT has steps to stop direct infinite recursion, but I don't think it will catch this.)

And I doubt that memory optimization is the problem. Unless you've got a ton of resources involved, like a multiple hour video, and ADRIFT holds all of it in memory at once, you're not going to run up against the limits of your computer in a normal game. (Or if you've got a ton of other things running at the time.)

(For scale, War and Peace is under 4 megabytes. A low end computer may have 4 gigabytes of memory.

(And storing text strings is probably the only place where ADRIFT will need to vary heavily as to how much memory it consumes, and even multiplied by the size of the undo stack, that won't come anywhere near the limits of a modern computer unless you're doing something seriously wrong.)
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2185
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri

Re: Out of Memory Error

Postby Lazzah » Fri Jul 27, 2012 5:50 pm

ralphmerridew wrote:Very probably your game: Are you displaying any long blocks of text, or complex ALRs?

For example, an ALR like "x -> ABC" and "B -> xyz" will infinite-recurse on a string containing an "x" or "B". (ADRIFT has steps to stop direct infinite recursion, but I don't think it will catch this.)

There are a number of long blocks of text, but what do you mean by "long".

As for ALRs like above, there are none at all, I haven't a clue what an ALR is anyway, the above is way over my head I'm afraid!
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Out of Memory Error

Postby ralphmerridew » Fri Jul 27, 2012 7:21 pm

Long as in "comparable to War and Peace long".

ALR is an old term for text substitution.

Also, do you have tasks that run other tasks, and that can potentially indirectly run themselves?
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2185
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri

Re: Out of Memory Error

Postby Lazzah » Fri Jul 27, 2012 9:05 pm

ralphmerridew wrote: Long as in "comparable to War and Peace long".

Not that long, the prologue and playing instructions are the biggest pages.

ralphmerridew wrote:ALR is an old term for text substitution.

There are a number of text overrides, if that's what you mean? Fairly simple stuff.

ralphmerridew wrote:Also, do you have tasks that run other tasks, and that can potentially indirectly run themselves?

Yes, of course I have, I thought that would be normal in an ADRIFT game?
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Out of Memory Error

Postby ralphmerridew » Sat Jul 28, 2012 6:36 pm

1: Go through the game one move at a time. See if the OOM errors show up at a consistent place. (If it's triggered directly by a move of the player's, it will be; if it's triggered by, say, a randomly moving character meeting some object, it won't be.)

2: Is there a way to disable text overrides? You might try turning those off and seeing if the OOM errors stop. If disabling text overrides stops the errors, you'll know that it's some sort of problem with them.

3: By tasks that can indirectly run themselves, I don't mean something like "A runs B; B runs C; C doesn't run any other tasks". I mean "A runs B; B runs C; C runs A". Because, unless you take careful steps, this can result in "A runs B the second time; B runs C the second time; C runs A the second time; A runs B the third time ...".
Bloodhounds can make you laugh and cuss in the same breath. They are endearing, faithful, and can sling drool ten feet in any direction. -- Virginia Lanier
User avatar
ralphmerridew
 
Posts: 2185
Joined: Fri Dec 13, 2002 11:56 pm
Location: Missouri

Re: Out of Memory Error

Postby Lazzah » Sat Jul 28, 2012 10:02 pm

ralphmerridew wrote: 1: Go through the game one move at a time. See if the OOM errors show up at a consistent place. (If it's triggered directly by a move of the player's, it will be; if it's triggered by, say, a randomly moving character meeting some object, it won't be.)

I have 6 macros that I use to play the game from start to finish (yes, it is that big!). I found that the OOMs started when I was part way through the 5th one, but then when I played the 5th one again from a saved position, no OOMs occured.

ralphmerridew wrote:2: Is there a way to disable text overrides? You might try turning those off and seeing if the OOM errors stop. If disabling text overrides stops the errors, you'll know that it's some sort of problem with them.

I cannot "disable" text overrides, only delete them.

ralphmerridew wrote:3: By tasks that can indirectly run themselves, I don't mean something like "A runs B; B runs C; C doesn't run any other tasks". I mean "A runs B; B runs C; C runs A". Because, unless you take careful steps, this can result in "A runs B the second time; B runs C the second time; C runs A the second time; A runs B the third time ...".

No, I have nothing like the above.

Another problem has manifested itself since v.5.24 was released. I have areas of dark locations and I have found that if I play the game using my macros and I save my game position at the end of each macro, when I enter a dark location carrying the light source the "It is totally dark, you cannot see a thing." message is displayed instead of the location description. However, I can see my inventory, which I shouldn't be able to do as it is "dark". If I play the game using the macros but I DO NOT do any saves, the dark locations work as they should do.

I have informed Campbell of this latest problem and I hope he can find out if it is my game or ADRIFT that is at fault.
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Out of Memory Error

Postby Lazzah » Thu Aug 02, 2012 6:01 pm

ralphmerridew wrote:Is there a way to disable text overrides? You might try turning those off and seeing if the OOM errors stop. If disabling text overrides stops the errors, you'll know that it's some sort of problem with them.

Hi Ralph,

I deleted a lot of text overrides (I had nearly 100!) and have just run through the parts of the game where the OOM errors were mostly happening and no errors occured at all. This was on my PC at work.

However, I have just run through the game on my laptop at home and a different error message appeared when I was running macro #4, it said: "Critical Error: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.". The runner crashed, so I restarted it and started play from a saved game. This time when running macro#4, the "dark locations" bug kicked in and they all displayed as "Nothing special." although the game still ran as normal. This time, however, there were no OOM errors at all and the macro ran OK all the way through.

I have reported this to Campbell and wonder if the two bugs are somehow linked?
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England


Return to ADRIFT 5.0

Who is online

Users browsing this forum: Google [Bot] and 1 guest