Solved

Out of memory error 7, a discussion

Posted on 1998-11-12
7
474 Views
Last Modified: 2012-06-27
Out of memory error 7

Ladies and Gentlemen,

I seek your information concerning my application that
at odd times falls into a "Out of Memory Error 7"

As with any product that you are about to put out on
the market, as a professional developer, you want to make
sure that your application is idiot proof.

Since the world keeps on making better idiots,
I feel the need to constantly revise and better my code.

I can not tell you how disappointed I am when I fall upon
a "Out of Memory Error 7". My application can run fine for
hours and then fall upon one of these.
Never during the same action or at the same place.

I ask you, to please share your comments or knowledge
concerning this issue. I am overwhelmed, and have no idea
what to do.

Thank you.
0
Comment
Question by:vienna
  • 3
  • 2
  • 2
7 Comments
 
LVL 3

Accepted Solution

by:
vikiing earned 0 total points
ID: 1444646
Error 7 appears when more memory was required than is available, or a 64K segment boundary was encountered. Based on Microstuff comments, this error is due to some of these reasons. Take a look at possible solutions:

You have too many applications, documents, or source files open.

Close any unnecessary applications, documents, or source files that are open.


You have a module or procedure that is too large.

Break extremely large modules or procedures into smaller ones.  This doesn't save memory, but it can prevent hitting 64K segment boundaries.


You are running Microsoft Windows in standard mode.

Restart Microsoft Windows in enhanced mode.


You are running Microsoft Windows in enhanced mode, but have run out of virtual memory.

Increase virtual memory by freeing some disk space, or at least ensure that some space is available.


You have terminate-and-stay-resident programs running.

Eliminate terminate-and-stay-resident programs.


You have many device drivers loaded.

Eliminate unnecessary device drivers.


You have run out of space for Public variables.

Reduce the number of Public variables.

0
 
LVL 4

Expert Comment

by:idcanada
ID: 1444647
You have run out of space for Public variables???

Just how much are we allowed?

Concerned.
0
 
LVL 1

Expert Comment

by:rayford
ID: 1444648
It seems like more of an operating system defect under Windows95 because my application is only getting error 7's under 95 and never under NT.  There is a large Public variable and a form module which if just over 100k but this is absurd to expect that a single large PV will cause errors only under Windows 95?  (using vb5 w/sp3 here).  There is no way to keep some form modules under 64k when you need treeview and wang imgedit controls on them you are starting out at 64k before you start writing code!
0
Technology Partners: 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!

 
LVL 4

Expert Comment

by:idcanada
ID: 1444649
Rayford,
would you mind working with me on this matter?
Hopefully, we can better our products in this process by sharing our findings.

Give me your email address.



0
 
LVL 1

Expert Comment

by:rayford
ID: 1444650
Vienna,  any application which does not error right at startup (as with mine) but does so later on is experiencing some sort of memory leak.  

Watch your use of exit sub and exit function calls etc. Replace those with goto bottom and put bottom: at the very end of the function so it will reach the actual natural END FUNCTION statement to return.  Also try to limit your jumps out of the middle of loops and try not to nest your FORS and IF's too deeply.  

Obviously be very careful of recursion and make certain it actually returns on recursive calls to the original first calling layer. (although those tend to eat up the stack before the memory)

0
 
LVL 3

Expert Comment

by:vikiing
ID: 1444651
Just a question, Rayford: ¿why you suggest a GOTO BOTTOM (with BOTTOM label pointing to END FUNCTION/SUB?; EXIT FUNCTION/SUB does exactly the same (it generates a RET machine-instruction, as EXIT SUB does).

Besides that, ¿what's the intended purpose of EXIT SUB if it doesn't work properly?; perhaps VB has a bug involving that, but just think of this: if there were any thing remaining at stack (where return addresses are stored), because EXIT SUB works different from END SUB, then the program will surely die almost immediately each time control returns from a SUB with EXIT. ¿Have you experienced something like that?

0
 
LVL 4

Expert Comment

by:idcanada
ID: 1444652
How many Public variables are we allowed?

0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Suggested Solutions

Title # Comments Views Activity
Visual Basic Excel Formatting error 4 140
bit defender blocks good applications 2 105
Using "ScreenUpdating" 6 83
VB6 - Scroll Mouse wheel on Picturebox 13 92
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

679 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