3097: Out of memory for Variables

Started by JTaylor, November 07, 2023, 12:23:19 PM

Previous topic - Next topic

JTaylor

Any suggestions for resolving this error?   Had someone reinstall an app on an new machine and they now encounter this error.   Running on Win10.  They were running fine on a previous machine and others are running the same app fine.   Runs fine for me locally.   Haven't encountered this in a long while.

Thanks.

Jim

kdmoyers

I once had a bug in some substitution code that was on the left side of the assignment statement (a real risky move, I know), inside a loop, and got this error because I was, in effect, making hundreds of variables.  But that's the only time I've seen it.
(don't use substitution kids)
The mind is everything; What you think, you become.

JTaylor

Will take a look on that front.  Just odd this is the only machine encountering the issue.    They are supposed to get the original database by tomorrow and replace the default one so will see what happens at that point.

Thanks for the reply.

Jim

td

There are no magical quick and easy solutions that I am aware of. You are getting the error because your script is defining more than 65000 variables or because someone has set a number considerably lower than that in the WWW-PROD.INI file. I would guess that the latter is very unlikely. Either way, you have a flawed assumption in your script. Since you can not reproduce the problem, you will need to resort to the tried-and-true debugging method - code inspection. There are some obvious areas to look at. For example, places where variables are created in loop control structures and places where you use substitution in loops.

Good luck.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

That was my thinking too but thought I would throw it out here and see if someone had any other ideas I hadn't considered.  Thanks.

Jim

ChuckC

It may be helpful to utilize IntControl 77 in your script to dump out current variable usage such as total memory allocated for strings, total number of variables assigned, number of variable slots available, etc.

JTaylor

Yes.  Thank you.  That is a very useful function.  I used that a lot years ago when the variable limit was very low and had to constantly use Drop() and DropWild() throughout my program to keep it running.  Then I was able to use the Registry entries and then they made the limit the same and was able to drop that update.   Currently waiting for the database backup to see if that impacts the situation and that will help narrow down the focus, I hope.


Jim

td

WinBatch only generates error 3097 when the maximum variable limit has been exceeded so string space is not an issue. Consider using IntControl 77 request codes 10, 11, and perhaps 72 if recursion is used in your script. You could post values to some form of storage at critical points in the scripts or something. Of course, it would require the cooperation of your user since you can't reproduce the problem.

<edit> If you are using an extender that automagically creates WIL variables, points in the script that call extender functions are worth an examination. </edit>
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

JTaylor

Yes.  I know where the problem most likely originates but not sure why for one machine.    I store a large number of settings for the application in a database.  Using substitution allows me to initialize these variables in a few lines of code rather than hundreds of lines.   Has never been an issue before so not sure what might be happening, assuming that is the issue.

I will report back once I figure it out in case it is useful to anyone else.

Thanks again.

Jim

JTaylor

Turns out they had ignored some errors during install of the ODBC driver which cascaded into other issues.  Once I got their backup database and resolved other issues caused by the first thing and reinstalled the app everything worked.   Thanks for all the suggestions and sorry to have wasted your time.

Jim