Out of Memory - Runtime error 7 on some user machines

I have an app written in VB5.  It runs fine on most machines, but I have about 2% of customers reporting they randomly get out of memory errors on machines that have plenty of free disk space and plenty of RAM.  Any good ideas on what the cause could be, or how to fix?
kdwAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

glittleCommented:
Plenty of free ram does not mean plenty of free conventional memory.  You didn't mention it, but I would think your using DOS/Win3.1x.  That being the case, check the loading of TSR's and move them high.  You want as much free memory as possible in the first meg or conventional memroy space.

An easy way to do this is to backup autoexec.bat and config.sys and run memmaker.

0
kdwAuthor Commented:
My fault.  I should have mentioned this is 32 bit application on Win95.
0
glittleCommented:
Has anyone used it in an NT 4.0 environment?
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

kdwAuthor Commented:
Works fine on most 95 and NT machines.
0
hdbashCommented:
Regarding, have you mentioned that it is a 32 bit application.  First, remember that VB5 is ONLY 32 bit.  Second, Windows 95 sits on top of good old dos and as such it does indeed care about how much conventional ram is available.  So, before dismissing the suggested answer,  try checking this also.

0
glittleCommented:
Taking hdbash's comment into consideration, look the mix and types of applications that are loaded stay resident on that 2%.  Then remove those that are not needed, if nothing else for testing, until the application works.  You can then make a determination as to what is needed and what can be permanently removed.  Worst case is  that on some machines apps would have to be stopped and started as needed.  Of course, knowing the problem, may allow you to modify your app to circumvent that.
0
ChrisLewisCommented:
Any thing you might be doing with big arrays, or keeping track of user histories etc.?

Is the error repeatable on the machines that are reporting it?

Might be an error that is not hit too offten, but is occuring because a user is doing something unexpected.

Lastly, Vb4 or vb5

Chris
0
ChrisLewisCommented:
D'oh!  just saw your vb 5 comment.  What Service pack are you running for vb 5?
0
kdwAuthor Commented:
Doing a lot with the TSRs isn't much of an option.  The program is distributed on the net, and many users aren't really willing to spend a lot of time helping debug.  I have SP2 for vb5.  I do have some pretty big arrays, it just bothers me that this works fine on most machines.

What is a good option instead of big string arrays I'm using to accomplish the same thing?

0
glittleCommented:
Depends a lot on how irritated they are with having to restart the app.  given the frequency of occurance, I would suspect itinerant 16 bit app or mix apps that you might find by simply looking at the active processes in the OS diagnostic.
0
innovateCommented:
Are you doing database access/manipulation?

The Access Jet relies on physical memory for transactions and transactions often use a lot more memory than expected.
0
kdwAuthor Commented:
no database access at all
0
innovateCommented:
mmm!

No recursive calls to anything?
0
kdwAuthor Commented:
no.  I really think it is a bad .dll file version mix of some sort.  One one users, I was able to remove a slider from the main form, and it went away.  On others though, it doesn't seem related to that control at all.
0
nithyasCommented:
Are you using HUGE forms/modules? I've run into this problem 'quite' a few times though it has been in VB 3. But the root problem is the same. There's a fixed availability of memory allocated for a form - stack (for local declarations) and heap (for module/global) memory. Usually we use a lot of 'stack' memory as most of our varibles are declared locally. When Windows runs out of memory to allocate, you get this error.

Solution.
1.Check if you use too many variables, arrays in a local function.
2.Avoid long names(function names, variables, objects, forms...). Reducing a variable name's length can save you space.
3.Change a couple of variables (arrays) from local to module level declaration can help you avoid this.
4.Change module level (Private)declarations of Enums and user defined types to 'Public' declarations (I know, not a good programming practice).
5.VB5 recommends form/module size not to exceed 64K to avoid this problem.
0
kdwAuthor Commented:
This problem is related to something on installation, such as a wrong version or missing .dll file.  If I create install with InstallSheild, I sometimes see this problem on a few pcs, but if I do it with setupwizard, it will correct it on those machines.
0
jefferpCommented:
In VB3 you can get an out of memory error when you attempt to do math on a declared single precision variable which happens to be zero. Sorry. I just have a lot of VB3 code laying around. But I would test it anyhow.
0
TilmannCommented:
I'm shure that RAM or diskspace isn't the problem.
My tip:
Be careful with recursive subs or functions. You also can create recursive subs, even if you don't want to. For example, you have a control named Control1. Manual setting of the focus can cause a recursive loop in your prog. Look at this:

Sub Control1_GotFocus
  DoSomeThing
End Sub

Sub DoSomeThing
  ... bla
  ... bla
  ... bla
  Control1.SetFocus
End Sub

This is only an example. I don't know what your app really does. Maybe this tip will help you.

Tilmann
0
TaoistBearCommented:
Rather than checking your RAM or Disk Space, you might want to check your Resources under Accessories, System Tools, Resource Meter.  These are 64K blocks of User, GDI, and System Resource memory that can get filled up.  You can also monitor these internally with an API call to see if they are getting filled up.

If you are using Crystal Reports or database functions, you may find that huge amounts of disk are required to handle temp files that have to do with Crystal or Recordsets.  This of course is only applicable if the error occurs during execution.

In case it is a bad DLL/OCX version, you can attempt to refresh all DLL's used by your program by overwriting existing ones.  This is not perfect because some software installs shared files in the execution directory, not the system directory, so if one of these programs is called before your program, then the wrong DLL may be loaded.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.