Solved

Out of Memory - Runtime error 7 on some user machines

Posted on 1997-10-17
19
426 Views
Last Modified: 2010-07-27
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?
0
Comment
Question by:kdw
  • 6
  • 4
  • 2
  • +6
19 Comments
 
LVL 1

Expert Comment

by:glittle
ID: 1438142
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
 

Author Comment

by:kdw
ID: 1438143
My fault.  I should have mentioned this is 32 bit application on Win95.
0
 
LVL 1

Expert Comment

by:glittle
ID: 1438144
Has anyone used it in an NT 4.0 environment?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:kdw
ID: 1438145
Works fine on most 95 and NT machines.
0
 

Expert Comment

by:hdbash
ID: 1438146
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
 
LVL 1

Expert Comment

by:glittle
ID: 1438147
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
 
LVL 3

Expert Comment

by:ChrisLewis
ID: 1438148
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
 
LVL 3

Expert Comment

by:ChrisLewis
ID: 1438149
D'oh!  just saw your vb 5 comment.  What Service pack are you running for vb 5?
0
 

Author Comment

by:kdw
ID: 1438150
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
 
LVL 1

Expert Comment

by:glittle
ID: 1438151
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
 
LVL 2

Expert Comment

by:innovate
ID: 1438152
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
 

Author Comment

by:kdw
ID: 1438153
no database access at all
0
 
LVL 2

Expert Comment

by:innovate
ID: 1438154
mmm!

No recursive calls to anything?
0
 

Author Comment

by:kdw
ID: 1438155
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
 

Expert Comment

by:nithyas
ID: 1438156
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
 

Author Comment

by:kdw
ID: 1438157
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
 

Expert Comment

by:jefferp
ID: 1438158
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
 

Expert Comment

by:Tilmann
ID: 1438159
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
 

Accepted Solution

by:
TaoistBear earned 200 total points
ID: 1438160
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

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question